|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Button
public class Button
This class provides a button widget for the AWT.
| Nested Class Summary | |
|---|---|
protected class |
Button.AccessibleAWTButton
|
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| 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 |
| Constructor Summary | |
|---|---|
Button()
Initializes a new instance of Button with no label. |
|
Button(String label)
Initializes a new instance of Button with the specified
label. |
|
| Method Summary | ||
|---|---|---|
void |
addActionListener(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. |
|
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this Button. |
|
String |
getActionCommand()
Returns the action command name for this button. |
|
ActionListener[] |
getActionListeners()
Returns all added ActionListener objects. |
|
String |
getLabel()
Returns the label for this button. |
|
|
getListeners(Class<T> listenerType)
Returns all registered EventListers of the given listenerType. |
|
protected String |
paramString()
Returns a debugging string for this button. |
|
protected void |
processActionEvent(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(ActionListener listener)
Removes the specified listener from the list of listeners that will receive action events from this button. |
|
void |
setActionCommand(String actionCommand)
Sets the action command name for this button to the specified value. |
|
void |
setLabel(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 |
| Constructor Detail |
|---|
public Button()
Button with no label.
HeadlessException - If GraphicsEnvironment.isHeadless()
returns truepublic Button(String label)
Button with the specified
label. The action command name is also initialized to this value.
label - The label to display on the button.
HeadlessException - If GraphicsEnvironment.isHeadless()
returns true| Method Detail |
|---|
public String getLabel()
public void setLabel(String label)
label - The new label for this button.public String getActionCommand()
public void setActionCommand(String actionCommand)
actionCommand - The new action command name.public void addActionListener(ActionListener listener)
listener - The listener to add.public void removeActionListener(ActionListener listener)
listener - The listener to remove.public ActionListener[] getActionListeners()
ActionListener objects.
public <T extends EventListener> T[] getListeners(Class<T> listenerType)
getListeners in class ComponentlistenerType - the listener type to return
ClassCastException - If listenerType doesn't specify a class or
interface that implements @see java.util.EventListener.Component.getComponentListeners(),
Component.getFocusListeners(),
Component.getHierarchyListeners(),
Component.getHierarchyBoundsListeners(),
Component.getKeyListeners(),
Component.getMouseListeners(),
Component.getMouseMotionListeners(),
Component.getMouseWheelListeners(),
Component.getInputMethodListeners(),
Component.getPropertyChangeListeners()public void addNotify()
addNotify in class ComponentComponent.isDisplayable(),
Component.removeNotify()protected void processEvent(AWTEvent event)
ActionEvent, then the
processActionEvent() 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
unless ActionEvent's are enabled. This will be done
implicitly if any listeners are added.
processEvent in class Componentevent - The event to process.Component.processComponentEvent(ComponentEvent),
Component.processFocusEvent(FocusEvent),
Component.processKeyEvent(KeyEvent),
Component.processMouseEvent(MouseEvent),
Component.processMouseMotionEvent(MouseEvent),
Component.processInputMethodEvent(InputMethodEvent),
Component.processHierarchyEvent(HierarchyEvent),
Component.processMouseWheelEvent(MouseWheelEvent)protected void processActionEvent(ActionEvent event)
event - The event to process.protected String paramString()
paramString in class Componentpublic AccessibleContext getAccessibleContext()
Button.
The context is created, if necessary.
getAccessibleContext in interface AccessiblegetAccessibleContext in class Component
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||