|
|||||||||
| Home >> All >> java >> [ awt overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.awt
Class Button

java.lang.Objectjava.awt.Component
java.awt.Button
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.image.ImageObserver, MenuContainer, java.io.Serializable
- public class Button
- extends Component
- implements java.io.Serializable, javax.accessibility.Accessible
- extends Component
This class provides a button widget for the AWT.
| Nested Class Summary | |
protected class |
Button.AccessibleAWTButton
|
| Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy, Component.HeavyweightInLightweightListener |
| Field Summary | |
private java.awt.event.ActionListener |
action_listeners
|
(package private) java.lang.String |
actionCommand
|
(package private) java.lang.String |
label
|
private static long |
next_button_number
|
private static long |
serialVersionUID
|
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
Button()
Initializes a new instance of Button with no label. |
|
Button(java.lang.String label)
Initializes a new instance of Button with the specified
label. |
|
| Method Summary | |
void |
addActionListener(java.awt.event.ActionListener listener)
Adds a new entry to the list of listeners that will receive action events from this button. |
void |
addNotify()
Notifies this button that it should create its native peer object. |
(package private) void |
dispatchEventImpl(AWTEvent e)
Implementation of dispatchEvent. |
(package private) java.lang.String |
generateName()
Generate a unique name for this button. |
javax.accessibility.AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this Button. |
java.lang.String |
getActionCommand()
Returns the action command name for this button. |
java.awt.event.ActionListener[] |
getActionListeners()
Returns all added ActionListener objects. |
java.lang.String |
getLabel()
Returns the label for this button. |
java.util.EventListener[] |
getListeners(java.lang.Class listenerType)
Returns all registered EventListers of the given listenerType. |
private static long |
getUniqueLong()
|
protected java.lang.String |
paramString()
Returns a debugging string for this button. |
protected void |
processActionEvent(java.awt.event.ActionEvent event)
This method dispatches an action event for this button to any registered listeners. |
protected void |
processEvent(AWTEvent event)
Processes an event for this button. |
void |
removeActionListener(java.awt.event.ActionListener listener)
Removes the specified listener from the list of listeners that will receive action events from this button. |
void |
setActionCommand(java.lang.String actionCommand)
Sets the action command name for this button to the specified value. |
void |
setLabel(java.lang.String label)
Sets the label for this button to the specified value. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
actionCommand
java.lang.String actionCommand
label
java.lang.String label
action_listeners
private transient java.awt.event.ActionListener action_listeners
next_button_number
private static transient long next_button_number
| Constructor Detail |
Button
public Button()
- Initializes a new instance of
Buttonwith no label.
Button
public Button(java.lang.String label)
- Initializes a new instance of
Buttonwith the specified label. The action command name is also initialized to this value.
| Method Detail |
getLabel
public java.lang.String getLabel()
- Returns the label for this button.
setLabel
public void setLabel(java.lang.String label)
- Sets the label for this button to the specified value.
getActionCommand
public java.lang.String getActionCommand()
- Returns the action command name for this button.
setActionCommand
public void setActionCommand(java.lang.String actionCommand)
- Sets the action command name for this button to the specified value.
addActionListener
public void addActionListener(java.awt.event.ActionListener listener)
- Adds a new entry to the list of listeners that will receive
action events from this button.
removeActionListener
public void removeActionListener(java.awt.event.ActionListener listener)
- Removes the specified listener from the list of listeners that will
receive action events from this button.
getActionListeners
public java.awt.event.ActionListener[] getActionListeners()
- Returns all added
ActionListenerobjects.- Since:
- 1.4
getListeners
public java.util.EventListener[] getListeners(java.lang.Class listenerType)
- Returns all registered EventListers of the given listenerType.
listenerType must be a subclass of EventListener, or a
ClassClassException is thrown.
- Overrides:
getListenersin classComponent
- Since:
- 1.3
addNotify
public void addNotify()
- Notifies this button that it should create its native peer object.
processEvent
protected void processEvent(AWTEvent event)
- Processes an event for this button. If the specified event is an
instance of
ActionEvent, then theprocessActionEvent()method is called to dispatch it to any registered listeners. Otherwise, the superclass method will be invoked. Note that this method will not be called at all unlessActionEvent's are enabled. This will be done implicitly if any listeners are added.- Overrides:
processEventin classComponent
processActionEvent
protected void processActionEvent(java.awt.event.ActionEvent event)
- This method dispatches an action event for this button to any
registered listeners.
dispatchEventImpl
void dispatchEventImpl(AWTEvent e)
- Description copied from class:
Component - Implementation of dispatchEvent. Allows trusted package classes
to dispatch additional events first. This implementation first
translates
eto an AWT 1.0 event and sends the result toComponent.postEvent(java.awt.Event)55 . If the AWT 1.0 event is not handled, and events of typeeare enabled for this component, e is passed on toComponent.processEvent(java.awt.AWTEvent)55 .- Overrides:
dispatchEventImplin classComponent
paramString
protected java.lang.String paramString()
- Returns a debugging string for this button.
- Overrides:
paramStringin classComponent
getAccessibleContext
public javax.accessibility.AccessibleContext getAccessibleContext()
- Gets the AccessibleContext associated with this
Button. The context is created, if necessary.- Specified by:
getAccessibleContextin interfacejavax.accessibility.Accessible- Overrides:
getAccessibleContextin classComponent
generateName
java.lang.String generateName()
- Generate a unique name for this button.
- Overrides:
generateNamein classComponent
getUniqueLong
private static long getUniqueLong()
|
|||||||||
| Home >> All >> java >> [ awt overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC