javax.swing
Class AbstractButton

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.Component sample code for java.awt.Component definition code for java.awt.Component 
      extended by java.awt.Container sample code for java.awt.Container definition code for java.awt.Container 
          extended by javax.swing.JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent 
              extended by javax.swing.AbstractButton
All Implemented Interfaces:
ImageObserver sample code for java.awt.image.ImageObserver definition code for java.awt.image.ImageObserver , ItemSelectable sample code for java.awt.ItemSelectable definition code for java.awt.ItemSelectable , MenuContainer sample code for java.awt.MenuContainer definition code for java.awt.MenuContainer , Serializable sample code for java.io.Serializable definition code for java.io.Serializable , SwingConstants sample code for javax.swing.SwingConstants definition code for javax.swing.SwingConstants
Direct Known Subclasses:
JButton sample code for javax.swing.JButton definition code for javax.swing.JButton , JMenuItem sample code for javax.swing.JMenuItem definition code for javax.swing.JMenuItem , JToggleButton sample code for javax.swing.JToggleButton definition code for javax.swing.JToggleButton

public abstract class AbstractButton
extends JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent
implements ItemSelectable sample code for java.awt.ItemSelectable definition code for java.awt.ItemSelectable , SwingConstants sample code for javax.swing.SwingConstants definition code for javax.swing.SwingConstants

Defines common behaviors for buttons and menu items. For further information see How to Use Buttons, Check Boxes, and Radio Buttons, a section in The Java Tutorial.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see XMLEncoder sample code for java.beans.XMLEncoder definition code for java.beans.XMLEncoder .

See Also:
Serialized Form

Nested Class Summary
protected  class AbstractButton.AccessibleAbstractButton sample code for javax.swing.AbstractButton.AccessibleAbstractButton definition code for javax.swing.AbstractButton.AccessibleAbstractButton
          This class implements accessibility support for the AbstractButton class.
protected  class AbstractButton.ButtonChangeListener sample code for javax.swing.AbstractButton.ButtonChangeListener definition code for javax.swing.AbstractButton.ButtonChangeListener
          Extends ChangeListener to be serializable.
 
Nested classes/interfaces inherited from class javax.swing.JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent
JComponent.AccessibleJComponent sample code for javax.swing.JComponent.AccessibleJComponent definition code for javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container sample code for java.awt.Container definition code for java.awt.Container
Container.AccessibleAWTContainer sample code for java.awt.Container.AccessibleAWTContainer definition code for java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component sample code for java.awt.Component definition code for java.awt.Component
Component.AccessibleAWTComponent sample code for java.awt.Component.AccessibleAWTComponent definition code for java.awt.Component.AccessibleAWTComponent , Component.BltBufferStrategy sample code for java.awt.Component.BltBufferStrategy definition code for java.awt.Component.BltBufferStrategy , Component.FlipBufferStrategy sample code for java.awt.Component.FlipBufferStrategy definition code for java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener actionListener sample code for javax.swing.AbstractButton.actionListener definition code for javax.swing.AbstractButton.actionListener
          The button model's ActionListener.
static String sample code for java.lang.String definition code for java.lang.String BORDER_PAINTED_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.BORDER_PAINTED_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.BORDER_PAINTED_CHANGED_PROPERTY
          Identifies a change to having the border drawn, or having it not drawn.
protected  ChangeEvent sample code for javax.swing.event.ChangeEvent definition code for javax.swing.event.ChangeEvent changeEvent sample code for javax.swing.AbstractButton.changeEvent definition code for javax.swing.AbstractButton.changeEvent
          Only one ChangeEvent is needed per button instance since the event's only state is the source property.
protected  ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener changeListener sample code for javax.swing.AbstractButton.changeListener definition code for javax.swing.AbstractButton.changeListener
          The button model's changeListener.
static String sample code for java.lang.String definition code for java.lang.String CONTENT_AREA_FILLED_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.CONTENT_AREA_FILLED_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.CONTENT_AREA_FILLED_CHANGED_PROPERTY
          Identifies a change to having the button paint the content area.
static String sample code for java.lang.String definition code for java.lang.String DISABLED_ICON_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.DISABLED_ICON_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.DISABLED_ICON_CHANGED_PROPERTY
          Identifies a change to the icon used when the button has been disabled.
static String sample code for java.lang.String definition code for java.lang.String DISABLED_SELECTED_ICON_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.DISABLED_SELECTED_ICON_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.DISABLED_SELECTED_ICON_CHANGED_PROPERTY
          Identifies a change to the icon used when the button has been disabled and selected.
static String sample code for java.lang.String definition code for java.lang.String FOCUS_PAINTED_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.FOCUS_PAINTED_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.FOCUS_PAINTED_CHANGED_PROPERTY
          Identifies a change to having the border highlighted when focused, or not.
static String sample code for java.lang.String definition code for java.lang.String HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY
          Identifies a change in the button's horizontal alignment.
static String sample code for java.lang.String definition code for java.lang.String HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY
          Identifies a change in the button's horizontal text position.
static String sample code for java.lang.String definition code for java.lang.String ICON_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.ICON_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.ICON_CHANGED_PROPERTY
          Identifies a change to the icon that represents the button.
protected  ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener itemListener sample code for javax.swing.AbstractButton.itemListener definition code for javax.swing.AbstractButton.itemListener
          The button model's ItemListener.
static String sample code for java.lang.String definition code for java.lang.String MARGIN_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.MARGIN_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.MARGIN_CHANGED_PROPERTY
          Identifies a change in the button's margins.
static String sample code for java.lang.String definition code for java.lang.String MNEMONIC_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.MNEMONIC_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.MNEMONIC_CHANGED_PROPERTY
          Identifies a change to the button's mnemonic.
protected  ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel model sample code for javax.swing.AbstractButton.model definition code for javax.swing.AbstractButton.model
          The data model that determines the button's state.
static String sample code for java.lang.String definition code for java.lang.String MODEL_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.MODEL_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.MODEL_CHANGED_PROPERTY
          Identifies a change in the button model.
static String sample code for java.lang.String definition code for java.lang.String PRESSED_ICON_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.PRESSED_ICON_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.PRESSED_ICON_CHANGED_PROPERTY
          Identifies a change to the icon used when the button has been pressed.
static String sample code for java.lang.String definition code for java.lang.String ROLLOVER_ENABLED_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.ROLLOVER_ENABLED_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.ROLLOVER_ENABLED_CHANGED_PROPERTY
          Identifies a change from rollover enabled to disabled or back to enabled.
static String sample code for java.lang.String definition code for java.lang.String ROLLOVER_ICON_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.ROLLOVER_ICON_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.ROLLOVER_ICON_CHANGED_PROPERTY
          Identifies a change to the icon used when the cursor is over the button.
static String sample code for java.lang.String definition code for java.lang.String ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY
          Identifies a change to the icon used when the cursor is over the button and it has been selected.
static String sample code for java.lang.String definition code for java.lang.String SELECTED_ICON_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.SELECTED_ICON_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.SELECTED_ICON_CHANGED_PROPERTY
          Identifies a change to the icon used when the button has been selected.
static String sample code for java.lang.String definition code for java.lang.String TEXT_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.TEXT_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.TEXT_CHANGED_PROPERTY
          Identifies a change in the button's text.
static String sample code for java.lang.String definition code for java.lang.String VERTICAL_ALIGNMENT_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.VERTICAL_ALIGNMENT_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.VERTICAL_ALIGNMENT_CHANGED_PROPERTY
          Identifies a change in the button's vertical alignment.
static String sample code for java.lang.String definition code for java.lang.String VERTICAL_TEXT_POSITION_CHANGED_PROPERTY sample code for javax.swing.AbstractButton.VERTICAL_TEXT_POSITION_CHANGED_PROPERTY definition code for javax.swing.AbstractButton.VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
          Identifies a change in the button's vertical text position.
 
Fields inherited from class javax.swing.JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent
accessibleContext sample code for javax.swing.JComponent.accessibleContext definition code for javax.swing.JComponent.accessibleContext , listenerList sample code for javax.swing.JComponent.listenerList definition code for javax.swing.JComponent.listenerList , TOOL_TIP_TEXT_KEY sample code for javax.swing.JComponent.TOOL_TIP_TEXT_KEY definition code for javax.swing.JComponent.TOOL_TIP_TEXT_KEY , ui sample code for javax.swing.JComponent.ui definition code for javax.swing.JComponent.ui , UNDEFINED_CONDITION sample code for javax.swing.JComponent.UNDEFINED_CONDITION definition code for javax.swing.JComponent.UNDEFINED_CONDITION , WHEN_ANCESTOR_OF_FOCUSED_COMPONENT sample code for javax.swing.JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT definition code for javax.swing.JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT , WHEN_FOCUSED sample code for javax.swing.JComponent.WHEN_FOCUSED definition code for javax.swing.JComponent.WHEN_FOCUSED , WHEN_IN_FOCUSED_WINDOW sample code for javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW definition code for javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component sample code for java.awt.Component definition code for java.awt.Component
BOTTOM_ALIGNMENT sample code for java.awt.Component.BOTTOM_ALIGNMENT definition code for java.awt.Component.BOTTOM_ALIGNMENT , CENTER_ALIGNMENT sample code for java.awt.Component.CENTER_ALIGNMENT definition code for java.awt.Component.CENTER_ALIGNMENT , LEFT_ALIGNMENT sample code for java.awt.Component.LEFT_ALIGNMENT definition code for java.awt.Component.LEFT_ALIGNMENT , RIGHT_ALIGNMENT sample code for java.awt.Component.RIGHT_ALIGNMENT definition code for java.awt.Component.RIGHT_ALIGNMENT , TOP_ALIGNMENT sample code for java.awt.Component.TOP_ALIGNMENT definition code for java.awt.Component.TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.SwingConstants sample code for javax.swing.SwingConstants definition code for javax.swing.SwingConstants
BOTTOM sample code for javax.swing.SwingConstants.BOTTOM definition code for javax.swing.SwingConstants.BOTTOM , CENTER sample code for javax.swing.SwingConstants.CENTER definition code for javax.swing.SwingConstants.CENTER , EAST sample code for javax.swing.SwingConstants.EAST definition code for javax.swing.SwingConstants.EAST , HORIZONTAL sample code for javax.swing.SwingConstants.HORIZONTAL definition code for javax.swing.SwingConstants.HORIZONTAL , LEADING sample code for javax.swing.SwingConstants.LEADING definition code for javax.swing.SwingConstants.LEADING , LEFT sample code for javax.swing.SwingConstants.LEFT definition code for javax.swing.SwingConstants.LEFT , NEXT sample code for javax.swing.SwingConstants.NEXT definition code for javax.swing.SwingConstants.NEXT , NORTH sample code for javax.swing.SwingConstants.NORTH definition code for javax.swing.SwingConstants.NORTH , NORTH_EAST sample code for javax.swing.SwingConstants.NORTH_EAST definition code for javax.swing.SwingConstants.NORTH_EAST , NORTH_WEST sample code for javax.swing.SwingConstants.NORTH_WEST definition code for javax.swing.SwingConstants.NORTH_WEST , PREVIOUS sample code for javax.swing.SwingConstants.PREVIOUS definition code for javax.swing.SwingConstants.PREVIOUS , RIGHT sample code for javax.swing.SwingConstants.RIGHT definition code for javax.swing.SwingConstants.RIGHT , SOUTH sample code for javax.swing.SwingConstants.SOUTH definition code for javax.swing.SwingConstants.SOUTH , SOUTH_EAST sample code for javax.swing.SwingConstants.SOUTH_EAST definition code for javax.swing.SwingConstants.SOUTH_EAST , SOUTH_WEST sample code for javax.swing.SwingConstants.SOUTH_WEST definition code for javax.swing.SwingConstants.SOUTH_WEST , TOP sample code for javax.swing.SwingConstants.TOP definition code for javax.swing.SwingConstants.TOP , TRAILING sample code for javax.swing.SwingConstants.TRAILING definition code for javax.swing.SwingConstants.TRAILING , VERTICAL sample code for javax.swing.SwingConstants.VERTICAL definition code for javax.swing.SwingConstants.VERTICAL , WEST sample code for javax.swing.SwingConstants.WEST definition code for javax.swing.SwingConstants.WEST
 
Fields inherited from interface java.awt.image.ImageObserver sample code for java.awt.image.ImageObserver definition code for java.awt.image.ImageObserver
ABORT sample code for java.awt.image.ImageObserver.ABORT definition code for java.awt.image.ImageObserver.ABORT , ALLBITS sample code for java.awt.image.ImageObserver.ALLBITS definition code for java.awt.image.ImageObserver.ALLBITS , ERROR sample code for java.awt.image.ImageObserver.ERROR definition code for java.awt.image.ImageObserver.ERROR , FRAMEBITS sample code for java.awt.image.ImageObserver.FRAMEBITS definition code for java.awt.image.ImageObserver.FRAMEBITS , HEIGHT sample code for java.awt.image.ImageObserver.HEIGHT definition code for java.awt.image.ImageObserver.HEIGHT , PROPERTIES sample code for java.awt.image.ImageObserver.PROPERTIES definition code for java.awt.image.ImageObserver.PROPERTIES , SOMEBITS sample code for java.awt.image.ImageObserver.SOMEBITS definition code for java.awt.image.ImageObserver.SOMEBITS , WIDTH sample code for java.awt.image.ImageObserver.WIDTH definition code for java.awt.image.ImageObserver.WIDTH
 
Constructor Summary
AbstractButton sample code for javax.swing.AbstractButton.AbstractButton() definition code for javax.swing.AbstractButton.AbstractButton() ()
           
 
Method Summary
 void addActionListener sample code for javax.swing.AbstractButton.addActionListener(java.awt.event.ActionListener) definition code for javax.swing.AbstractButton.addActionListener(java.awt.event.ActionListener) (ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener  l)
          Adds an ActionListener to the button.
 void addChangeListener sample code for javax.swing.AbstractButton.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.AbstractButton.addChangeListener(javax.swing.event.ChangeListener) (ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
          Adds a ChangeListener to the button.
protected  void addImpl sample code for javax.swing.AbstractButton.addImpl(java.awt.Component, java.lang.Object, int) definition code for javax.swing.AbstractButton.addImpl(java.awt.Component, java.lang.Object, int) (Component sample code for java.awt.Component definition code for java.awt.Component  comp, Object sample code for java.lang.Object definition code for java.lang.Object  constraints, int index)
          Adds the specified component to this container at the specified index, refer to Container.addImpl(Component, Object, int) sample code for java.awt.Container.addImpl(java.awt.Component, java.lang.Object, int) definition code for java.awt.Container.addImpl(java.awt.Component, java.lang.Object, int) for a complete description of this method.
 void addItemListener sample code for javax.swing.AbstractButton.addItemListener(java.awt.event.ItemListener) definition code for javax.swing.AbstractButton.addItemListener(java.awt.event.ItemListener) (ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener  l)
          Adds an ItemListener to the checkbox.
protected  int checkHorizontalKey sample code for javax.swing.AbstractButton.checkHorizontalKey(int, java.lang.String) definition code for javax.swing.AbstractButton.checkHorizontalKey(int, java.lang.String) (int key, String sample code for java.lang.String definition code for java.lang.String  exception)
          Verify that key is a legal value for the horizontalAlignment properties.
protected  int checkVerticalKey sample code for javax.swing.AbstractButton.checkVerticalKey(int, java.lang.String) definition code for javax.swing.AbstractButton.checkVerticalKey(int, java.lang.String) (int key, String sample code for java.lang.String definition code for java.lang.String  exception)
          Ensures that the key is a valid.
protected  void configurePropertiesFromAction sample code for javax.swing.AbstractButton.configurePropertiesFromAction(javax.swing.Action) definition code for javax.swing.AbstractButton.configurePropertiesFromAction(javax.swing.Action) (Action sample code for javax.swing.Action definition code for javax.swing.Action  a)
          Factory method which sets the ActionEvent source's properties according to values from the Action instance.
protected  ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener createActionListener sample code for javax.swing.AbstractButton.createActionListener() definition code for javax.swing.AbstractButton.createActionListener() ()
           
protected  PropertyChangeListener sample code for java.beans.PropertyChangeListener definition code for java.beans.PropertyChangeListener createActionPropertyChangeListener sample code for javax.swing.AbstractButton.createActionPropertyChangeListener(javax.swing.Action) definition code for javax.swing.AbstractButton.createActionPropertyChangeListener(javax.swing.Action) (Action sample code for javax.swing.Action definition code for javax.swing.Action  a)
          Factory method which creates the PropertyChangeListener used to update the ActionEvent source as properties change on its Action instance.
protected  ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener createChangeListener sample code for javax.swing.AbstractButton.createChangeListener() definition code for javax.swing.AbstractButton.createChangeListener() ()
          Subclasses that want to handle ChangeEvents differently can override this to return another ChangeListener implementation.
protected  ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener createItemListener sample code for javax.swing.AbstractButton.createItemListener() definition code for javax.swing.AbstractButton.createItemListener() ()
           
 void doClick sample code for javax.swing.AbstractButton.doClick() definition code for javax.swing.AbstractButton.doClick() ()
          Programmatically perform a "click".
 void doClick sample code for javax.swing.AbstractButton.doClick(int) definition code for javax.swing.AbstractButton.doClick(int) (int pressTime)
          Programmatically perform a "click".
protected  void fireActionPerformed sample code for javax.swing.AbstractButton.fireActionPerformed(java.awt.event.ActionEvent) definition code for javax.swing.AbstractButton.fireActionPerformed(java.awt.event.ActionEvent) (ActionEvent sample code for java.awt.event.ActionEvent definition code for java.awt.event.ActionEvent  event)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireItemStateChanged sample code for javax.swing.AbstractButton.fireItemStateChanged(java.awt.event.ItemEvent) definition code for javax.swing.AbstractButton.fireItemStateChanged(java.awt.event.ItemEvent) (ItemEvent sample code for java.awt.event.ItemEvent definition code for java.awt.event.ItemEvent  event)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireStateChanged sample code for javax.swing.AbstractButton.fireStateChanged() definition code for javax.swing.AbstractButton.fireStateChanged() ()
          Notifies all listeners that have registered interest for notification on this event type.
 Action sample code for javax.swing.Action definition code for javax.swing.Action getAction sample code for javax.swing.AbstractButton.getAction() definition code for javax.swing.AbstractButton.getAction() ()
          Returns the currently set Action for this ActionEvent source, or null if no Action is set.
 String sample code for java.lang.String definition code for java.lang.String getActionCommand sample code for javax.swing.AbstractButton.getActionCommand() definition code for javax.swing.AbstractButton.getActionCommand() ()
          Returns the action command for this button.
 ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener [] getActionListeners sample code for javax.swing.AbstractButton.getActionListeners() definition code for javax.swing.AbstractButton.getActionListeners() ()
          Returns an array of all the ActionListeners added to this AbstractButton with addActionListener().
 ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener [] getChangeListeners sample code for javax.swing.AbstractButton.getChangeListeners() definition code for javax.swing.AbstractButton.getChangeListeners() ()
          Returns an array of all the ChangeListeners added to this AbstractButton with addChangeListener().
 Icon sample code for javax.swing.Icon definition code for javax.swing.Icon getDisabledIcon sample code for javax.swing.AbstractButton.getDisabledIcon() definition code for javax.swing.AbstractButton.getDisabledIcon() ()
          Returns the icon used by the button when it's disabled.
 Icon