GNU Classpath (0.98) | |
Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
JButton
s can display a label,
an Icon
or both.
Nested Class Summary | |
protected class |
|
Nested classes/interfaces inherited from class javax.swing.AbstractButton | |
AbstractButton.AccessibleAbstractButton , AbstractButton.ButtonChangeListener |
Nested classes/interfaces inherited from class javax.swing.JComponent | |
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container | |
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component | |
Component.AccessibleAWTComponent , Component.BltBufferStrategy , Component.FlipBufferStrategy |
Field Summary |
Fields inherited from class javax.swing.JComponent | |
TOOL_TIP_TEXT_KEY , UNDEFINED_CONDITION , WHEN_ANCESTOR_OF_FOCUSED_COMPONENT , WHEN_FOCUSED , WHEN_IN_FOCUSED_WINDOW , accessibleContext , listenerList , ui |
Fields inherited from class java.awt.Component | |
BOTTOM_ALIGNMENT , CENTER_ALIGNMENT , LEFT_ALIGNMENT , RIGHT_ALIGNMENT , TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver | |
ABORT , ALLBITS , ERROR , FRAMEBITS , HEIGHT , PROPERTIES , SOMEBITS , WIDTH |
Fields inherited from interface javax.swing.SwingConstants | |
BOTTOM , CENTER , EAST , HORIZONTAL , LEADING , LEFT , NEXT , NORTH , NORTH_EAST , NORTH_WEST , PREVIOUS , RIGHT , SOUTH , SOUTH_EAST , SOUTH_WEST , TOP , TRAILING , VERTICAL , WEST |
Constructor Summary | |
| |
Method Summary | |
protected void |
|
AccessibleContext |
|
String |
|
boolean |
|
boolean |
|
protected String |
|
void |
|
void |
|
void |
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public JButton(String text)
Creates a new button with the specified text and no icon.
- Parameters:
text
- the button text (null
permitted, will be substituted by an empty string).
public JButton(String text, Icon icon)
Creates a new button with the specified text and icon.
- Parameters:
text
- the button text (null
permitted, will be substituted by an empty string).icon
- the icon (null
permitted).
public JButton(Action a)
Creates a new button from the specified action.
- Parameters:
a
- the action (null
permitted).
- See Also:
AbstractButton.setAction(Action)
protected void configurePropertiesFromAction(Action a)
Configure various properties of the button by reading properties of anAction
. The mapping of properties is as follows:In addition, this method always sets the button's "enabled" property to the value of the Action's "enabled" property. If the provided Action is
Action keyed property AbstractButton property NAME text SMALL_ICON icon SHORT_DESCRIPTION toolTipText MNEMONIC_KEY mnemonic ACTION_COMMAND_KEY actionCommand null
, the text, icon, and toolTipText properties of the button are set tonull
, and the "enabled" property is set totrue
; the mnemonic and actionCommand properties are unchanged. If the icon is set, it is displayed instead of the NAME test.
- Overrides:
- configurePropertiesFromAction in interface AbstractButton
- Parameters:
a
- An Action to configure the button from
public AccessibleContext getAccessibleContext()
Returns the object that provides accessibility features for thisJButton
component.
- Specified by:
- getAccessibleContext in interface Accessible
- Overrides:
- getAccessibleContext in interface JComponent
- Returns:
- The accessible context (an instance of
JButton.AccessibleJButton
).
public 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 aJButton
.
- Overrides:
- getUIClassID in interface JComponent
- Returns:
"ButtonUI"
.
public boolean isDefaultButton()
Returnstrue
if this button is the default button in itsJRootPane
. The default button gets automatically activated when the user pressesENTER
(or whatever key this is bound to in the current Look and Feel).
- Returns:
true
if this button is the default button in itsJRootPane
public boolean isDefaultCapable()
Returnstrue
if this button can act as the default button. This istrue
by default.
- Returns:
true
if this button can act as the default button
protected String paramString()
Returns an implementation-dependent string describing the attributes of thisJButton
.
- Overrides:
- paramString in interface AbstractButton
- Returns:
- A string describing the attributes of this
JButton
(nevernull
).
public 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.
- Overrides:
- removeNotify in interface JComponent
public void setDefaultCapable(boolean defaultCapable)
Sets thedefaultCapable
property which indicates if this button may become the default button in itsJRootPane
.
- Parameters:
defaultCapable
-true
if this button can become the default button in its JRootPane,false
otherwise
public void updateUI()
Sets this button's UI delegate to the default (obtained from theUIManager
) for the current look and feel.
- Overrides:
- updateUI in interface AbstractButton
GNU Classpath (0.98) |