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

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

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

revision 1.22 by abalkiss, Wed Jul 13 15:30:54 2005 UTC revision 1.23 by rabbit78, Fri Jul 15 11:41:06 2005 UTC
# Line 133  public class JToggleButton extends Abstr Line 133  public class JToggleButton extends Abstr
133      /**      /**
134       * Sets the pressed state of the button.  The selected state       * Sets the pressed state of the button.  The selected state
135       * of the button also changes follwing the button being pressed.       * of the button also changes follwing the button being pressed.
      * Unlike DefaultButtonModel, does not fire an ActionEvent.  
136       *       *
137       * @param b true if the button is pressed down.       * @param b true if the button is pressed down.
138       */       */
# Line 159  public class JToggleButton extends Abstr Line 158  public class JToggleButton extends Abstr
158        // setPressed(false) == mouse release on us,        // setPressed(false) == mouse release on us,
159        // if we were armed, we flip the selected state.        // if we were armed, we flip the selected state.
160        if (!p && isArmed())        if (!p && isArmed())
161          setSelected(! isSelected());          {
162      }            fireActionPerformed(new ActionEvent(this,
163                                                  ActionEvent.ACTION_PERFORMED,
164      /**                                                actionCommand));
165       * Sets the selected state of the button.  Unlike DefaultButtonModel,            setSelected(! isSelected());
166       * fires an ActionEvent.          }
      *  
      * @param s true if button is selected  
      */  
     public void setSelected(boolean s)  
     {  
       super.setSelected(s);  
       fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,  
                                           actionCommand));  
167      }      }
168    }    }
169    
# Line 269  public class JToggleButton extends Abstr Line 260  public class JToggleButton extends Abstr
260     */     */
261    public JToggleButton (String text, Icon icon, boolean selected)    public JToggleButton (String text, Icon icon, boolean selected)
262    {    {
263      super(text, icon);      super();
264        init(text, icon);
265    
266      setModel(new ToggleButtonModel());        setModel(new ToggleButtonModel());  
267      model.setSelected(selected);      model.setSelected(selected);

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

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