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

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

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

revision 1.35 by rschuster, Wed Jul 13 01:18:42 2005 UTC revision 1.36 by rschuster, Wed Jul 13 22:47:56 2005 UTC
# Line 600  public abstract class AbstractButton ext Line 600  public abstract class AbstractButton ext
600    /**    /**
601     * <p>Returns the action command string for this button's model.</p>     * <p>Returns the action command string for this button's model.</p>
602     *     *
603     * <p>If the action command string is <code>null</code>, the button's     * <p>If the action command was set to <code>null</code>, the button's
604     * text (label) is returned instead.</p>     * text (label) is returned instead.</p>
605     *     *
606     * @return The current action command string from the button's model     * @return The current action command string from the button's model
607     */     */
608    public String getActionCommand()    public String getActionCommand()
609    {    {
610      String ac = getModel().getActionCommand();      String ac = model.getActionCommand();
611    
612      return (ac != null) ? ac : text;      return (ac != null ? ac : text);
613    }    }
614    
615    /**    /**
616     * Sets the action command string for this button's model.     * Sets the action command string for this button's model.
617     *     *
618     * @param aCommand The new action command string to set in the button's     * @param actionCommand The new action command string to set in the button's
619     * model.     * model.
620     */     */
621    public void setActionCommand(String aCommand)    public void setActionCommand(String actionCommand)
622    {    {
623      getModel().setActionCommand(aCommand);      model.setActionCommand(actionCommand);
624    }    }
625    
626    /**    /**
# Line 749  public abstract class AbstractButton ext Line 749  public abstract class AbstractButton ext
749     */     */
750    protected void fireActionPerformed(ActionEvent e)    protected void fireActionPerformed(ActionEvent e)
751    {    {
752      e.setSource(this);          // Dispatch a copy of the given ActionEvent in order to
753            // set the source and action command correctly.
754        ActionEvent ae = new ActionEvent(
755            this,
756            e.getID(),
757            getActionCommand(),
758            e.getWhen(),
759            e.getModifiers());
760    
761      ActionListener[] listeners = getActionListeners();      ActionListener[] listeners = getActionListeners();
762            
763      for (int i = 0; i < listeners.length; i++)      for (int i = 0; i < listeners.length; i++)
764        listeners[i].actionPerformed(e);        listeners[i].actionPerformed(ae);
765    }    }
766    
767    /**    /**

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36

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