http://cookxml.sf.net/cookswing/

Tag <button>

All Ancestor Tags

<listeners> , <abstractbutton> , <component>

Class

JButton

An implementation of a "push" button. See How to Use Buttons, Check Boxes, and Radio Buttons in The Java Tutorial for information and examples of using buttons.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions, see the JButton key assignments.

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 {@link java.beans.XMLEncoder}.


Attribute Summary
Attribute Type Description
action Action Sets the Action for the ActionEvent source.
actioncommand <text> Sets the action command for this button.
actionmap ActionMap Sets the ActionMap to am.
alignmentx <float> Sets the the vertical alignment.
alignmenty <float> Sets the the horizontal alignment.
autoscrolls <boolean> Sets the autoscrolls property.
background <color> Sets the background color of this component.
border Border Sets the border of this component.
borderpainted <boolean> Sets the borderPainted property.
bounds <rectangle> Moves and resizes this component to conform to the new bounding rectangle r.
componentorientation ComponentOrientation Sets the language-sensitive orientation that is to be used to order the elements or text within this component.
contentareafilled <boolean> Sets the contentAreaFilled property.
cursor <cursor> Sets the cursor image to the specified cursor.
debuggraphicsoptions <int> Enables or disables diagnostic information about every graphics operation performed within the component or one of its children.
defaultcapable <boolean> Sets the defaultCapable property, which determines whether this button can be made the default button for its root pane.
defaultlocale <locale> Sets the default locale used to initialize each JComponent's locale property upon creation.
disabledicon <icon> Sets the disabled icon for the button.
disabledselectedicon <icon> Sets the disabled selection icon for the button.
displayedmnemonicindex <int> Provides a hint to the look and feel as to which character in the text should be decorated to represent the mnemonic.
doublebuffered <boolean> Sets whether the this component should use a buffer to paint.
droptarget DropTarget Associate a DropTarget with this component.
enabled <boolean> Enables (or disables) the button.
focusable <boolean> Sets the focusable state of this Component to the specified value.
focuscycleroot <boolean> Sets whether this Container is the root of a focus traversal cycle.
focuspainted <boolean> Sets the paintFocus property, which must be true for the focus state to be painted.
focustraversalkeysenabled <boolean> Sets whether focus traversal keys are enabled for this Component.
focustraversalpolicy FocusTraversalPolicy Sets the focus traversal policy that will manage keyboard traversal of this Container's children, if this Container is a focus cycle root.
font <font> Sets the font for this component.
foreground <color> Sets the foreground color of this component.
horizontalalignment <int> Sets the horizontal alignment of the icon and text.
horizontaltextposition <int> Sets the horizontal position of the text relative to the icon.
icon <icon> Sets the button's default icon.
icontextgap <int> If both the icon and text properties are set, this property defines the space between them.
ignorerepaint <boolean> Sets whether or not paint messages received from the operating system should be ignored.
inputverifier InputVerifier Sets the input verifier for this component.
label <text> Sets the label text.
layout LayoutManager Sets the layout manager for this container.
locale <locale> Sets the locale of this component.
location <point> Moves this component to a new location.
margin <insets> Sets space for margin between the button's border and the label.
maximumsize <dimension> Sets the maximum size of this component to a constant value.
minimumsize <dimension> Sets the minimum size of this component to a constant value.
mnemonic <char> This method is now obsolete, please use setMnemonic(int) to set the mnemonic for a button.
mnemonic <int> Sets the keyboard mnemonic on the current model.
model ButtonModel Sets the model that this button represents.
multiclickthreshhold Long Sets the amount of time (in milliseconds) required between mouse press events for the button to generate the corresponding action events.
name <text> Sets the name of the component to the specified string.
nextfocusablecomponent Component Overrides the default FocusTraversalPolicy for this JComponent's focus traversal cycle by unconditionally setting the specified Component as the next Component in the cycle, and this JComponent as the specified Component's previous Component in the cycle.
opaque <boolean> If true the component paints every pixel within its bounds.
preferredsize <dimension> Sets the preferred size of this component.
pressedicon <icon> Sets the pressed icon for the button.
requestfocusenabled <boolean> Provides a hint as to whether or not this JComponent should get focus.
rolloverenabled <boolean> Sets the rolloverEnabled property, which must be true for rollover effects to occur.
rollovericon <icon> Sets the rollover icon for the button.
rolloverselectedicon <icon> Sets the rollover selected icon for the button.
selected <boolean> Sets the state of the button.
selectedicon <icon> Sets the selected icon for the button.
size <dimension> Resizes this component so that it has width d.width and height d.height.
text <text> Sets the button's text.
tooltiptext <text> Registers the text to display in a tool tip.
transferhandler TransferHandler Sets the transferHandler property, which is null if the component does not support data transfer operations.
ui ButtonUI Sets the L&F object that renders this component.
verifyinputwhenfocustarget <boolean> Sets the value to indicate whether input verifier for the current focus owner will be called before this component requests focus.
verticalalignment <int> Sets the vertical alignment of the icon and text.
verticaltextposition <int> Sets the vertical position of the text relative to the icon.
visible <boolean> Makes the component visible or invisible.