All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.AbstractButton
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----com.sun.java.swing.JComponent
|
+----com.sun.java.swing.AbstractButton
- public abstract class AbstractButton
- extends JComponent
- implements ItemSelectable, SwingConstants
-
actionListener
-
-
actionListenerList
-
-
border
-
-
changeEvent
- Only one ChangeEvent is needed per button instance since the
event's only state is the source property.
-
changeListener
- The button's model listeners.
-
changeListenerList
- The lists of client listeners.
-
itemListener
-
-
itemListenerList
-
-
model
-
-
AbstractButton()
-
-
addActionListener(ActionListener)
- adds an ActionListener to the button
-
addChangeListener(ChangeListener)
- Adds a ChangeListener to the button.
-
addItemListener(ItemListener)
- adds an ItemListener to the checkbox
-
checkHorizontalKey(int, String)
- Ensures that the key is a valid.
-
checkVerticalKey(int, String)
- Ensures that the key is a valid.
-
createActionListener()
-
-
createChangeListener()
-
-
createItemListener()
-
-
doClick()
- Programatically perform a "click".
-
getActionCommand()
- Returns the action command for this button.
-
getAlignmentX()
-
Set the default horizontal alignment left
-
getBorder()
-
-
getDisabledIcon()
- Returns the icon used by the button when it's disabled.
-
getHorizontalAlignment()
- Returns the horizontal alignment of the icon and text.
-
getHorizontalTextPosition()
- Sets the horizontal position of the text relative to the icon.
-
getIcon()
- Returns the default icon.
-
getKeyAccelerator()
- Convenience to get the accelerator from the the current model
-
getLabel()
-
Deprecated.
-
getMaximumSize()
- PENDING(jeff): see above
-
getMaxSizeEqualsPrefSize()
- PENDING(jeff): see above
-
getModel()
- Get the model that this button represents.
-
getPad()
- Returns a pad amount between the button's border and
the label.
-
getPressedIcon()
- Returns the pressed icon for the button.
-
getRolloverIcon()
- Returns the rollover icon for the button.
-
getSelectedIcon()
- Returns the selected icon for the button.
-
getSelectedObjects()
-
-
getText()
- Returns the button's text.
-
getUI()
- Returns the button's current UI.
-
getVerticalAlignment()
- Returns the vertical alignment of the text and icon.
-
getVerticalTextPosition()
- Returns the vertical position of the text relative to the icon
Valid keys: CENTER (the default), TOP, BOTTOM
-
init(String, Icon)
-
-
isBorderPainted()
- Checks whether the border should be painted.
-
isFocusPainted()
- Checks whether focus should be painted.
-
isOpaque()
-
-
isSelected()
- Returns the state of the button.
-
removeActionListener(ActionListener)
- removes an ActionListener from the button
-
removeChangeListener(ChangeListener)
- Removes a ChangeListener from the button.
-
removeItemListener(ItemListener)
- removes an ItemListener from the button
-
setActionCommand(String)
- Sets the action command for this button.
-
setBorder(Border)
-
-
setBorderPainted(boolean)
- Sets whether the border should be painted.
-
setDisabledIcon(Icon)
- Sets the disabled icon for the button.
-
setEnabled(boolean)
- Enables (or disables) the button.
-
setFocusPainted(boolean)
- Sets whether focus should be painted.
-
setHorizontalAlignment(int)
- Sets the horizontal alignment of the icon and text.
-
setHorizontalTextPosition(int)
- Sets the horizontal position of the text relative to the icon.
-
setIcon(Icon)
- Sets the button's default icon.
-
setKeyAccelerator(char)
- Convenience to set the key accelerator on the current model
-
setLabel(String)
-
Deprecated.
-
setMaxSizeEqualsPrefSize(boolean)
- PENDING(jeff): This is a hack to set getMaximumSize to
to Short.MAX_VALUE.
-
setModel(ButtonModel)
- Set the model that this button represents.
-
setPad(Insets)
- Sets a pad amount between the button's border and
the label.
-
setPressedIcon(Icon)
- Sets the pressed icon for the button.
-
setRolloverIcon(Icon)
- Sets the rollover icon for the button.
-
setSelected(boolean)
- Sets the state of the button.
-
setSelectedIcon(Icon)
- Sets the selected icon for the button.
-
setText(String)
- Sets the button's text.
-
setUI(ButtonUI)
- Sets the button's UI.
-
setVerticalAlignment(int)
- Sets the vertical alignment of the icon and text.
-
setVerticalTextPosition(int)
- Sets the vertical position of the text relative to the icon.
-
updateUI()
- Gets a new UI object from the default UIFactory.
model
protected ButtonModel model
border
protected Border border
changeListener
protected ChangeListener changeListener
- The button's model listeners.
actionListener
protected ActionListener actionListener
itemListener
protected ItemListener itemListener
changeListenerList
protected ChangeListener changeListenerList
- The lists of client listeners.
actionListenerList
protected ActionListener actionListenerList
itemListenerList
protected ItemListener itemListenerList
changeEvent
protected ChangeEvent changeEvent
- Only one ChangeEvent is needed per button instance since the
event's only state is the source property. The source of events
generated is always "this".
AbstractButton
public AbstractButton()
getText
public String getText()
- Returns the button's text.
- See Also:
- setText
setText
public void setText(String t)
- Sets the button's text.
- Parameters:
- t - the string used to set the text
- See Also:
- getText
isSelected
public boolean isSelected()
- Returns the state of the button. True if the
radiobutton is selected, false if it's not.
setSelected
public void setSelected(boolean b)
- Sets the state of the button.
doClick
public void doClick()
- Programatically perform a "click". This does the same
thing as if the user had pressed and released the button.
setMaxSizeEqualsPrefSize
public void setMaxSizeEqualsPrefSize(boolean b)
- PENDING(jeff): This is a hack to set getMaximumSize to
to Short.MAX_VALUE. The current getMaximumSize is
hacked to return preferredSize, which is wrong.
REMIND: get rid of this once Tim's BoxLayout
penalty system is in place.
- Parameters:
- b - - true turns on the hack (maxSize == prefSize)
- false turns off the hack (maxSize == Short.MAX_VALUE)
getMaxSizeEqualsPrefSize
public boolean getMaxSizeEqualsPrefSize()
- PENDING(jeff): see above
- See Also:
- setMaxSizeEqualsPrefSize
getMaximumSize
public Dimension getMaximumSize()
- PENDING(jeff): see above
- Overrides:
- getMaximumSize in class JComponent
- See Also:
- setMaxSizeEqualsPrefSize
setPad
public void setPad(Insets pad)
- Sets a pad amount between the button's border and
the label. Setting to null will cause the button to
use the default padding.
getPad
public Insets getPad()
- Returns a pad amount between the button's border and
the label.
getIcon
public Icon getIcon()
- Returns the default icon.
- See Also:
- setIcon
setIcon
public void setIcon(Icon g)
- Sets the button's default icon. This icon is
also used as the "pressed" and "disabled" icon if
there is no explicitly set pressed icon.
- Parameters:
- g - the icon used as the default image
- See Also:
- getIcon, setPressedIcon
getPressedIcon
public Icon getPressedIcon()
- Returns the pressed icon for the button.
- See Also:
- setPressedIcon
setPressedIcon
public void setPressedIcon(Icon g)
- Sets the pressed icon for the button.
- Parameters:
- g - the icon used as the "pressed" image
- See Also:
- getPressedIcon
getSelectedIcon
public Icon getSelectedIcon()
- Returns the selected icon for the button.
- See Also:
- setSelectedIcon
setSelectedIcon
public void setSelectedIcon(Icon g)
- Sets the selected icon for the button.
- Parameters:
- g - the icon used as the "selected" image
- See Also:
- getSelectedIcon
getRolloverIcon
public Icon getRolloverIcon()
- Returns the rollover icon for the button.
- See Also:
- setRolloverIcon
setRolloverIcon
public void setRolloverIcon(Icon g)
- Sets the rollover icon for the button.
- Parameters:
- g - the icon used as the "rollover" image
- See Also:
- getRolloverIcon
getDisabledIcon
public Icon getDisabledIcon()
- Returns the icon used by the button when it's disabled.
If not no disabled icon has been set, the button constructs
one from the default icon. REMIND: the disabled icon really
should be created (if necesary) by the L&F.
- See Also:
- getPressedIcon, setDisabledIcon
setDisabledIcon
public void setDisabledIcon(Icon g)
- Sets the disabled icon for the button.
- Parameters:
- g - the icon used as the disabled image
- See Also:
- getDisabledIcon
getVerticalAlignment
public int getVerticalAlignment()
- Returns the vertical alignment of the text and icon.
Valid keys: CENTER (the default), TOP, BOTTOM
setVerticalAlignment
public void setVerticalAlignment(int x)
- Sets the vertical alignment of the icon and text.
Valid keys: CENTER (the default), TOP, BOTTOM
getHorizontalAlignment
public int getHorizontalAlignment()
- Returns the horizontal alignment of the icon and text.
Valid keys: CENTER (the default), LEFT, RIGHT
setHorizontalAlignment
public void setHorizontalAlignment(int x)
- Sets the horizontal alignment of the icon and text.
Valid keys: CENTER (the default), LEFT, RIGHT
getVerticalTextPosition
public int getVerticalTextPosition()
- Returns the vertical position of the text relative to the icon
Valid keys: CENTER (the default), TOP, BOTTOM
setVerticalTextPosition
public void setVerticalTextPosition(int x)
- Sets the vertical position of the text relative to the icon.
Valid keys: CENTER (the default), TOP, BOTTOM
getHorizontalTextPosition
public int getHorizontalTextPosition()
- Sets the horizontal position of the text relative to the icon.
Valid keys: RIGHT (the default), LEFT, CENTER
setHorizontalTextPosition
public void setHorizontalTextPosition(int x)
- Sets the horizontal position of the text relative to the icon.
Valid keys: RIGHT (the default), LEFT, CENTER
checkHorizontalKey
protected int checkHorizontalKey(int key,
String exception)
- Ensures that the key is a valid. Throws an IllegalArgument exception
exception otherwise.
checkVerticalKey
protected int checkVerticalKey(int key,
String exception)
- Ensures that the key is a valid. Throws an IllegalArgument exception
exception otherwise.
setActionCommand
public void setActionCommand(String actionCommand)
- Sets the action command for this button.
getActionCommand
public String getActionCommand()
- Returns the action command for this button.
isBorderPainted
public boolean isBorderPainted()
- Checks whether the border should be painted.
- See Also:
- setBorderPainted
isOpaque
public boolean isOpaque()
- Overrides:
- isOpaque in class JComponent
setBorderPainted
public void setBorderPainted(boolean b)
- Sets whether the border should be painted.
- Parameters:
- b - if true, the border is painted.
- See Also:
- isBorderPainted
isFocusPainted
public boolean isFocusPainted()
- Checks whether focus should be painted.
- See Also:
- setFocusPainted
setFocusPainted
public void setFocusPainted(boolean b)
- Sets whether focus should be painted.
- Parameters:
- b - if true, the focus state is painted.
- See Also:
- isFocusPainted
setKeyAccelerator
public void setKeyAccelerator(char aKey)
- Convenience to set the key accelerator on the current model
getKeyAccelerator
public char getKeyAccelerator()
- Convenience to get the accelerator from the the current model
getModel
public ButtonModel getModel()
- Get the model that this button represents.
- See Also:
- setModel
setModel
public void setModel(ButtonModel newModel)
- Set the model that this button represents.
- Parameters:
- m - the Model
- See Also:
- getModel
getUI
public ButtonUI getUI()
- Returns the button's current UI.
- See Also:
- setUI
setUI
public void setUI(ButtonUI ui)
- Sets the button's UI.
- Parameters:
- ui - the new ButtonUI
- See Also:
- getUI
updateUI
public void updateUI()
- Gets a new UI object from the default UIFactory.
- Overrides:
- updateUI in class JComponent
addChangeListener
public void addChangeListener(ChangeListener l)
- Adds a ChangeListener to the button.
removeChangeListener
public void removeChangeListener(ChangeListener l)
- Removes a ChangeListener from the button.
addActionListener
public void addActionListener(ActionListener l)
- adds an ActionListener to the button
removeActionListener
public void removeActionListener(ActionListener l)
- removes an ActionListener from the button
createChangeListener
protected ChangeListener createChangeListener()
createActionListener
protected ActionListener createActionListener()
createItemListener
protected ItemListener createItemListener()
setEnabled
public void setEnabled(boolean b)
- Enables (or disables) the button.
- Overrides:
- setEnabled in class Component
getAlignmentX
public float getAlignmentX()
- Set the default horizontal alignment left
- Overrides:
- getAlignmentX in class JComponent
getLabel
public String getLabel()
- Note: getLabel() is deprecated.
- Replaced by getText()
setLabel
public void setLabel(String label)
- Note: setLabel() is deprecated.
- Replaced by setText(text)
addItemListener
public void addItemListener(ItemListener l)
- adds an ItemListener to the checkbox
removeItemListener
public void removeItemListener(ItemListener l)
- removes an ItemListener from the button
getSelectedObjects
public Object[] getSelectedObjects()
init
protected void init(String text,
Icon icon)
setBorder
public void setBorder(Border border)
getBorder
public Border getBorder()
All Packages Class Hierarchy This Package Previous Next Index