javax.swing
public class JButton extends AbstractButton implements Accessible
JButton
s can display a label,
an {@link Icon} or both.
Nested Class Summary | |
---|---|
protected class | JButton.AccessibleJButton
Accessibility support for JButtons. |
Constructor Summary | |
---|---|
JButton()
Creates a new button with an empty string for the button text and no
icon. | |
JButton(Action a)
Creates a new button from the specified action.
| |
JButton(Icon icon)
Creates a new button with the specified icon (and an empty string for
the button text).
| |
JButton(String text)
Creates a new button with the specified text and no icon.
| |
JButton(String text, Icon icon)
Creates a new button with the specified text and icon.
|
Method Summary | |
---|---|
protected void | configurePropertiesFromAction(Action a) |
AccessibleContext | getAccessibleContext()
Returns the object that provides accessibility features for this
JButton component.
|
String | getUIClassID()
Returns the suffix ( "ButtonUI" in this case) used to
determine the class name for a UI delegate that can provide the look and
feel for a JButton .
|
boolean | isDefaultButton()
Returns true if this button is the default button in
its JRootPane . |
boolean | isDefaultCapable()
Returns true if this button can act as the default button.
|
protected String | paramString()
Returns an implementation-dependent string describing the attributes of
this JButton .
|
void | removeNotify()
Overrides JComponent.removeNotify to check if this button is currently
set as the default button on the RootPane, and if so, sets the RootPane's
default button to null to ensure the RootPane doesn't hold onto an invalid
button reference. |
void | setDefaultCapable(boolean defaultCapable)
Sets the defaultCapable property which indicates if
this button may become the default button in its JRootPane .
|
void | updateUI()
Sets this button's UI delegate to the default (obtained from the
{@link UIManager}) for the current look and feel. |
Parameters: a the action (null
permitted).
See Also: setAction
Parameters: icon the icon (null
permitted).
Parameters: text the button text (null
permitted, will be
substituted by an empty string).
Parameters: text the button text (null
permitted, will be
substituted by an empty string). icon the icon (null
permitted).
JButton
component.
Returns: The accessible context (an instance of {@link AccessibleJButton}).
"ButtonUI"
in this case) used to
determine the class name for a UI delegate that can provide the look and
feel for a JButton
.
Returns: "ButtonUI"
.
true
if this button is the default button in
its JRootPane
. The default button gets automatically
activated when the user presses ENTER
(or whatever
key this is bound to in the current Look and Feel).
Returns: true
if this button is the default button in
its JRootPane
See Also: isDefaultCapable JButton getDefaultButton setDefaultButton
true
if this button can act as the default button.
This is true
by default.
Returns: true
if this button can act as the default button
See Also: JButton isDefaultButton getDefaultButton setDefaultButton
JButton
.
Returns: A string describing the attributes of this JButton
(never null
).
defaultCapable
property which indicates if
this button may become the default button in its JRootPane
.
Parameters: defaultCapable true
if this button can become the
default button in its JRootPane, false
otherwise
See Also: JButton isDefaultButton getDefaultButton setDefaultButton