AbstractButton (Java Platform SE 8 ) (original) (raw)
Modifier and Type
Method
Description
protected void
[actionPropertyChanged](../../javax/swing/AbstractButton.html#actionPropertyChanged-javax.swing.Action-java.lang.String-)([Action](../../javax/swing/Action.html "interface in javax.swing") action,[String](../../java/lang/String.html "class in java.lang") propertyName)
Updates the button's state in response to property changes in the associated action.
void
[addActionListener](../../javax/swing/AbstractButton.html#addActionListener-java.awt.event.ActionListener-)([ActionListener](../../java/awt/event/ActionListener.html "interface in java.awt.event") l)
Adds an ActionListener
to the button.
void
[addChangeListener](../../javax/swing/AbstractButton.html#addChangeListener-javax.swing.event.ChangeListener-)([ChangeListener](../../javax/swing/event/ChangeListener.html "interface in javax.swing.event") l)
Adds a ChangeListener
to the button.
protected void
[addImpl](../../javax/swing/AbstractButton.html#addImpl-java.awt.Component-java.lang.Object-int-)([Component](../../java/awt/Component.html "class in java.awt") comp,[Object](../../java/lang/Object.html "class in java.lang") constraints, int index)
void
[addItemListener](../../javax/swing/AbstractButton.html#addItemListener-java.awt.event.ItemListener-)([ItemListener](../../java/awt/event/ItemListener.html "interface in java.awt.event") l)
Adds an ItemListener
to the checkbox
.
protected int
[checkHorizontalKey](../../javax/swing/AbstractButton.html#checkHorizontalKey-int-java.lang.String-)(int key,[String](../../java/lang/String.html "class in java.lang") exception)
Verify that the key
argument is a legal value for thehorizontalAlignment
and horizontalTextPosition
properties.
protected int
[checkVerticalKey](../../javax/swing/AbstractButton.html#checkVerticalKey-int-java.lang.String-)(int key,[String](../../java/lang/String.html "class in java.lang") exception)
Verify that the key
argument is a legal value for the vertical properties.
protected void
[configurePropertiesFromAction](../../javax/swing/AbstractButton.html#configurePropertiesFromAction-javax.swing.Action-)([Action](../../javax/swing/Action.html "interface in javax.swing") a)
Sets the properties on this button to match those in the specifiedAction
.
protected [ActionListener](../../java/awt/event/ActionListener.html "interface in java.awt.event")
[createActionListener](../../javax/swing/AbstractButton.html#createActionListener--)()
protected [PropertyChangeListener](../../java/beans/PropertyChangeListener.html "interface in java.beans")
[createActionPropertyChangeListener](../../javax/swing/AbstractButton.html#createActionPropertyChangeListener-javax.swing.Action-)([Action](../../javax/swing/Action.html "interface in javax.swing") a)
Creates and returns a PropertyChangeListener
that is responsible for listening for changes from the specifiedAction
and updating the appropriate properties.
protected [ChangeListener](../../javax/swing/event/ChangeListener.html "interface in javax.swing.event")
[createChangeListener](../../javax/swing/AbstractButton.html#createChangeListener--)()
Subclasses that want to handle ChangeEvents
differently can override this to return another ChangeListener
implementation.
protected [ItemListener](../../java/awt/event/ItemListener.html "interface in java.awt.event")
[createItemListener](../../javax/swing/AbstractButton.html#createItemListener--)()
void
[doClick](../../javax/swing/AbstractButton.html#doClick--)()
Programmatically perform a "click".
void
[doClick](../../javax/swing/AbstractButton.html#doClick-int-)(int pressTime)
Programmatically perform a "click".
protected void
[fireActionPerformed](../../javax/swing/AbstractButton.html#fireActionPerformed-java.awt.event.ActionEvent-)([ActionEvent](../../java/awt/event/ActionEvent.html "class in java.awt.event") event)
Notifies all listeners that have registered interest for notification on this event type.
protected void
[fireItemStateChanged](../../javax/swing/AbstractButton.html#fireItemStateChanged-java.awt.event.ItemEvent-)([ItemEvent](../../java/awt/event/ItemEvent.html "class in java.awt.event") event)
Notifies all listeners that have registered interest for notification on this event type.
protected void
[fireStateChanged](../../javax/swing/AbstractButton.html#fireStateChanged--)()
Notifies all listeners that have registered interest for notification on this event type.
[Action](../../javax/swing/Action.html "interface in javax.swing")
[getAction](../../javax/swing/AbstractButton.html#getAction--)()
Returns the currently set Action
for thisActionEvent
source, or null
if no Action
is set.
[String](../../java/lang/String.html "class in java.lang")
[getActionCommand](../../javax/swing/AbstractButton.html#getActionCommand--)()
Returns the action command for this button.
[ActionListener](../../java/awt/event/ActionListener.html "interface in java.awt.event")[]
[getActionListeners](../../javax/swing/AbstractButton.html#getActionListeners--)()
Returns an array of all the ActionListener
s added to this AbstractButton with addActionListener().
[ChangeListener](../../javax/swing/event/ChangeListener.html "interface in javax.swing.event")[]
[getChangeListeners](../../javax/swing/AbstractButton.html#getChangeListeners--)()
Returns an array of all the ChangeListener
s added to this AbstractButton with addChangeListener().
[Icon](../../javax/swing/Icon.html "interface in javax.swing")
[getDisabledIcon](../../javax/swing/AbstractButton.html#getDisabledIcon--)()
Returns the icon used by the button when it's disabled.
[Icon](../../javax/swing/Icon.html "interface in javax.swing")
[getDisabledSelectedIcon](../../javax/swing/AbstractButton.html#getDisabledSelectedIcon--)()
Returns the icon used by the button when it's disabled and selected.
int
[getDisplayedMnemonicIndex](../../javax/swing/AbstractButton.html#getDisplayedMnemonicIndex--)()
Returns the character, as an index, that the look and feel should provide decoration for as representing the mnemonic character.
boolean
[getHideActionText](../../javax/swing/AbstractButton.html#getHideActionText--)()
Returns the value of the hideActionText
property, which determines whether the button displays text from theAction
.
int
[getHorizontalAlignment](../../javax/swing/AbstractButton.html#getHorizontalAlignment--)()
Returns the horizontal alignment of the icon and text.
int
[getHorizontalTextPosition](../../javax/swing/AbstractButton.html#getHorizontalTextPosition--)()
Returns the horizontal position of the text relative to the icon.
[Icon](../../javax/swing/Icon.html "interface in javax.swing")
[getIcon](../../javax/swing/AbstractButton.html#getIcon--)()
Returns the default icon.
int
[getIconTextGap](../../javax/swing/AbstractButton.html#getIconTextGap--)()
Returns the amount of space between the text and the icon displayed in this button.
[ItemListener](../../java/awt/event/ItemListener.html "interface in java.awt.event")[]
[getItemListeners](../../javax/swing/AbstractButton.html#getItemListeners--)()
Returns an array of all the ItemListener
s added to this AbstractButton with addItemListener().
[String](../../java/lang/String.html "class in java.lang")
[getLabel](../../javax/swing/AbstractButton.html#getLabel--)()
[Insets](../../java/awt/Insets.html "class in java.awt")
[getMargin](../../javax/swing/AbstractButton.html#getMargin--)()
Returns the margin between the button's border and the label.
int
[getMnemonic](../../javax/swing/AbstractButton.html#getMnemonic--)()
Returns the keyboard mnemonic from the the current model.
[ButtonModel](../../javax/swing/ButtonModel.html "interface in javax.swing")
[getModel](../../javax/swing/AbstractButton.html#getModel--)()
Returns the model that this button represents.
long
[getMultiClickThreshhold](../../javax/swing/AbstractButton.html#getMultiClickThreshhold--)()
Gets the amount of time (in milliseconds) required between mouse press events for the button to generate the corresponding action events.
[Icon](../../javax/swing/Icon.html "interface in javax.swing")
[getPressedIcon](../../javax/swing/AbstractButton.html#getPressedIcon--)()
Returns the pressed icon for the button.
[Icon](../../javax/swing/Icon.html "interface in javax.swing")
[getRolloverIcon](../../javax/swing/AbstractButton.html#getRolloverIcon--)()
Returns the rollover icon for the button.
[Icon](../../javax/swing/Icon.html "interface in javax.swing")
[getRolloverSelectedIcon](../../javax/swing/AbstractButton.html#getRolloverSelectedIcon--)()
Returns the rollover selection icon for the button.
[Icon](../../javax/swing/Icon.html "interface in javax.swing")
[getSelectedIcon](../../javax/swing/AbstractButton.html#getSelectedIcon--)()
Returns the selected icon for the button.
[Object](../../java/lang/Object.html "class in java.lang")[]
[getSelectedObjects](../../javax/swing/AbstractButton.html#getSelectedObjects--)()
Returns an array (length 1) containing the label ornull
if the button is not selected.
[String](../../java/lang/String.html "class in java.lang")
[getText](../../javax/swing/AbstractButton.html#getText--)()
Returns the button's text.
[ButtonUI](../../javax/swing/plaf/ButtonUI.html "class in javax.swing.plaf")
[getUI](../../javax/swing/AbstractButton.html#getUI--)()
Returns the L&F object that renders this component.
int
[getVerticalAlignment](../../javax/swing/AbstractButton.html#getVerticalAlignment--)()
Returns the vertical alignment of the text and icon.
int
[getVerticalTextPosition](../../javax/swing/AbstractButton.html#getVerticalTextPosition--)()
Returns the vertical position of the text relative to the icon.
boolean
[imageUpdate](../../javax/swing/AbstractButton.html#imageUpdate-java.awt.Image-int-int-int-int-int-)([Image](../../java/awt/Image.html "class in java.awt") img, int infoflags, int x, int y, int w, int h)
This is overridden to return false if the current Icon
'sImage
is not equal to the passed in Image
img
.
protected void
[init](../../javax/swing/AbstractButton.html#init-java.lang.String-javax.swing.Icon-)([String](../../java/lang/String.html "class in java.lang") text,[Icon](../../javax/swing/Icon.html "interface in javax.swing") icon)
boolean
[isBorderPainted](../../javax/swing/AbstractButton.html#isBorderPainted--)()
Gets the borderPainted
property.
boolean
[isContentAreaFilled](../../javax/swing/AbstractButton.html#isContentAreaFilled--)()
Gets the contentAreaFilled
property.
boolean
[isFocusPainted](../../javax/swing/AbstractButton.html#isFocusPainted--)()
Gets the paintFocus
property.
boolean
[isRolloverEnabled](../../javax/swing/AbstractButton.html#isRolloverEnabled--)()
Gets the rolloverEnabled
property.
boolean
[isSelected](../../javax/swing/AbstractButton.html#isSelected--)()
Returns the state of the button.
protected void
[paintBorder](../../javax/swing/AbstractButton.html#paintBorder-java.awt.Graphics-)([Graphics](../../java/awt/Graphics.html "class in java.awt") g)
Paint the button's border if BorderPainted
property is true and the button has a border.
protected [String](../../java/lang/String.html "class in java.lang")
[paramString](../../javax/swing/AbstractButton.html#paramString--)()
Returns a string representation of this AbstractButton
.
void
[removeActionListener](../../javax/swing/AbstractButton.html#removeActionListener-java.awt.event.ActionListener-)([ActionListener](../../java/awt/event/ActionListener.html "interface in java.awt.event") l)
Removes an ActionListener
from the button.
void
[removeChangeListener](../../javax/swing/AbstractButton.html#removeChangeListener-javax.swing.event.ChangeListener-)([ChangeListener](../../javax/swing/event/ChangeListener.html "interface in javax.swing.event") l)
Removes a ChangeListener from the button.
void
[removeItemListener](../../javax/swing/AbstractButton.html#removeItemListener-java.awt.event.ItemListener-)([ItemListener](../../java/awt/event/ItemListener.html "interface in java.awt.event") l)
Removes an ItemListener
from the button.
void
[removeNotify](../../javax/swing/AbstractButton.html#removeNotify--)()
Notifies this component that it no longer has a parent component.
void
[setAction](../../javax/swing/AbstractButton.html#setAction-javax.swing.Action-)([Action](../../javax/swing/Action.html "interface in javax.swing") a)
Sets the Action
.
void
[setActionCommand](../../javax/swing/AbstractButton.html#setActionCommand-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") actionCommand)
Sets the action command for this button.
void
[setBorderPainted](../../javax/swing/AbstractButton.html#setBorderPainted-boolean-)(boolean b)
Sets the borderPainted
property.
void
[setContentAreaFilled](../../javax/swing/AbstractButton.html#setContentAreaFilled-boolean-)(boolean b)
Sets the contentAreaFilled
property.
void
[setDisabledIcon](../../javax/swing/AbstractButton.html#setDisabledIcon-javax.swing.Icon-)([Icon](../../javax/swing/Icon.html "interface in javax.swing") disabledIcon)
Sets the disabled icon for the button.
void
[setDisabledSelectedIcon](../../javax/swing/AbstractButton.html#setDisabledSelectedIcon-javax.swing.Icon-)([Icon](../../javax/swing/Icon.html "interface in javax.swing") disabledSelectedIcon)
Sets the disabled selection icon for the button.
void
[setDisplayedMnemonicIndex](../../javax/swing/AbstractButton.html#setDisplayedMnemonicIndex-int-)(int index)
Provides a hint to the look and feel as to which character in the text should be decorated to represent the mnemonic.
void
[setEnabled](../../javax/swing/AbstractButton.html#setEnabled-boolean-)(boolean b)
Enables (or disables) the button.
void
[setFocusPainted](../../javax/swing/AbstractButton.html#setFocusPainted-boolean-)(boolean b)
Sets the paintFocus
property, which must be true
for the focus state to be painted.
void
[setHideActionText](../../javax/swing/AbstractButton.html#setHideActionText-boolean-)(boolean hideActionText)
Sets the hideActionText
property, which determines whether the button displays text from the Action
.
void
[setHorizontalAlignment](../../javax/swing/AbstractButton.html#setHorizontalAlignment-int-)(int alignment)
Sets the horizontal alignment of the icon and text.
void
[setHorizontalTextPosition](../../javax/swing/AbstractButton.html#setHorizontalTextPosition-int-)(int textPosition)
Sets the horizontal position of the text relative to the icon.
void
[setIcon](../../javax/swing/AbstractButton.html#setIcon-javax.swing.Icon-)([Icon](../../javax/swing/Icon.html "interface in javax.swing") defaultIcon)
Sets the button's default icon.
void
[setIconTextGap](../../javax/swing/AbstractButton.html#setIconTextGap-int-)(int iconTextGap)
If both the icon and text properties are set, this property defines the space between them.
void
[setLabel](../../javax/swing/AbstractButton.html#setLabel-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") label)
void
[setLayout](../../javax/swing/AbstractButton.html#setLayout-java.awt.LayoutManager-)([LayoutManager](../../java/awt/LayoutManager.html "interface in java.awt") mgr)
void
[setMargin](../../javax/swing/AbstractButton.html#setMargin-java.awt.Insets-)([Insets](../../java/awt/Insets.html "class in java.awt") m)
Sets space for margin between the button's border and the label.
void
[setMnemonic](../../javax/swing/AbstractButton.html#setMnemonic-char-)(char mnemonic)
This method is now obsolete, please use setMnemonic(int)
to set the mnemonic for a button.
void
[setMnemonic](../../javax/swing/AbstractButton.html#setMnemonic-int-)(int mnemonic)
Sets the keyboard mnemonic on the current model.
void
[setModel](../../javax/swing/AbstractButton.html#setModel-javax.swing.ButtonModel-)([ButtonModel](../../javax/swing/ButtonModel.html "interface in javax.swing") newModel)
Sets the model that this button represents.
void
[setMultiClickThreshhold](../../javax/swing/AbstractButton.html#setMultiClickThreshhold-long-)(long threshhold)
Sets the amount of time (in milliseconds) required between mouse press events for the button to generate the corresponding action events.
void
[setPressedIcon](../../javax/swing/AbstractButton.html#setPressedIcon-javax.swing.Icon-)([Icon](../../javax/swing/Icon.html "interface in javax.swing") pressedIcon)
Sets the pressed icon for the button.
void
[setRolloverEnabled](../../javax/swing/AbstractButton.html#setRolloverEnabled-boolean-)(boolean b)
Sets the rolloverEnabled
property, which must be true
for rollover effects to occur.
void
[setRolloverIcon](../../javax/swing/AbstractButton.html#setRolloverIcon-javax.swing.Icon-)([Icon](../../javax/swing/Icon.html "interface in javax.swing") rolloverIcon)
Sets the rollover icon for the button.
void
[setRolloverSelectedIcon](../../javax/swing/AbstractButton.html#setRolloverSelectedIcon-javax.swing.Icon-)([Icon](../../javax/swing/Icon.html "interface in javax.swing") rolloverSelectedIcon)
Sets the rollover selected icon for the button.
void
[setSelected](../../javax/swing/AbstractButton.html#setSelected-boolean-)(boolean b)
Sets the state of the button.
void
[setSelectedIcon](../../javax/swing/AbstractButton.html#setSelectedIcon-javax.swing.Icon-)([Icon](../../javax/swing/Icon.html "interface in javax.swing") selectedIcon)
Sets the selected icon for the button.
void
[setText](../../javax/swing/AbstractButton.html#setText-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") text)
Sets the button's text.
void
[setUI](../../javax/swing/AbstractButton.html#setUI-javax.swing.plaf.ButtonUI-)([ButtonUI](../../javax/swing/plaf/ButtonUI.html "class in javax.swing.plaf") ui)
Sets the L&F object that renders this component.
void
[setVerticalAlignment](../../javax/swing/AbstractButton.html#setVerticalAlignment-int-)(int alignment)
Sets the vertical alignment of the icon and text.
void
[setVerticalTextPosition](../../javax/swing/AbstractButton.html#setVerticalTextPosition-int-)(int textPosition)
Sets the vertical position of the text relative to the icon.
void
[updateUI](../../javax/swing/AbstractButton.html#updateUI--)()
Resets the UI property to a value from the current look and feel.