51 |
import javax.swing.event.EventListenerList; |
import javax.swing.event.EventListenerList; |
52 |
|
|
53 |
/** |
/** |
54 |
* The purpose of this class is to model the dynamic state of an abstract |
* The pUrpose of this class is to model the dynamic state of an abstract |
55 |
* button. The concrete button type holding this state may be a a "toggle" |
* button. The concrete button type holding this state may be a a "toggle" |
56 |
* button (checkbox, radio button) or a "push" button (menu button, button). |
* button (checkbox, radio button) or a "push" button (menu button, button). |
57 |
* If the model is disabled, only the "selected" property can be changed. An |
* If the model is disabled, only the "selected" property can be changed. An |
337 |
|
|
338 |
if ((oldstate & SELECTED) == 0 && (newstate & SELECTED) == SELECTED) |
if ((oldstate & SELECTED) == 0 && (newstate & SELECTED) == SELECTED) |
339 |
{ |
{ |
340 |
fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, |
fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, |
341 |
null, ItemEvent.SELECTED)); |
null, ItemEvent.SELECTED)); |
342 |
if (group != null) |
if (group != null) |
343 |
group.setSelected(this, true); |
group.setSelected(this, true); |
344 |
} |
} |
345 |
|
|
346 |
else if ((oldstate & SELECTED) == SELECTED && (newstate & SELECTED) == 0) |
else if ((oldstate & SELECTED) == SELECTED && (newstate & SELECTED) == 0) |
347 |
{ |
{ |
348 |
fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, |
fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, |
349 |
null, ItemEvent.DESELECTED)); |
null, ItemEvent.DESELECTED)); |
350 |
if (group != null) |
if (group != null) |
351 |
group.setSelected(this, false); |
group.setSelected(this, false); |
352 |
} |
} |
476 |
{ |
{ |
477 |
if (mnemonic != key) |
if (mnemonic != key) |
478 |
{ |
{ |
479 |
mnemonic = key; |
mnemonic = key; |
480 |
fireStateChanged(); |
fireStateChanged(); |
481 |
} |
} |
482 |
} |
} |
483 |
|
|
492 |
{ |
{ |
493 |
if (actionCommand != s) |
if (actionCommand != s) |
494 |
{ |
{ |
495 |
actionCommand = s; |
actionCommand = s; |
496 |
fireStateChanged(); |
fireStateChanged(); |
497 |
} |
} |
498 |
} |
} |
499 |
|
|
519 |
{ |
{ |
520 |
if (group != g) |
if (group != g) |
521 |
{ |
{ |
522 |
group = g; |
group = g; |
523 |
fireStateChanged(); |
fireStateChanged(); |
524 |
} |
} |
525 |
} |
} |
526 |
|
|