/[classpath]/classpath/javax/swing/DefaultButtonModel.java
ViewVC logotype

Diff of /classpath/javax/swing/DefaultButtonModel.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18 by rabbit78, Fri May 13 11:59:08 2005 UTC revision 1.19 by rabbit78, Mon Jun 20 14:35:53 2005 UTC
# Line 51  import javax.swing.event.ChangeListener; Line 51  import javax.swing.event.ChangeListener;
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
# Line 337  public class DefaultButtonModel implemen Line 337  public class DefaultButtonModel implemen
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        }        }
# Line 476  public class DefaultButtonModel implemen Line 476  public class DefaultButtonModel implemen
476    {    {
477      if (mnemonic != key)      if (mnemonic != key)
478        {        {
479          mnemonic = key;          mnemonic = key;
480          fireStateChanged();          fireStateChanged();
481        }        }
482    }    }
483    
# Line 492  public class DefaultButtonModel implemen Line 492  public class DefaultButtonModel implemen
492    {    {
493      if (actionCommand != s)      if (actionCommand != s)
494        {        {
495          actionCommand = s;          actionCommand = s;
496          fireStateChanged();          fireStateChanged();
497        }        }
498    }    }
499    
# Line 519  public class DefaultButtonModel implemen Line 519  public class DefaultButtonModel implemen
519    {    {
520      if (group != g)      if (group != g)
521        {        {
522          group = g;          group = g;
523          fireStateChanged();          fireStateChanged();
524        }        }
525    }    }
526    

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26