Whole document tree
java.awt
|
Inner Class Summary | |
protected class |
Button.AccessibleAWTButton
This class implements accessibility support for the Button class. |
Inner classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent |
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()
Constructs a Button with no label. |
|
Button(String label)
Constructs a Button with the specified label. |
Method Summary | |
void |
addActionListener(ActionListener l)
Adds the specified action listener to receive action events from this button. |
void |
addNotify()
Creates the peer of the button. |
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this Button. |
String |
getActionCommand()
Returns the command name of the action event fired by this button. |
String |
getLabel()
Gets the label of this button. |
EventListener[] |
getListeners(Class listenerType)
Return an array of all the listeners that were added to the Button with addXXXListener(), where XXX is the name of the listenerType
argument. |
protected String |
paramString()
Returns the parameter string representing the state of this button. |
protected void |
processActionEvent(ActionEvent e)
Processes action events occurring on this button by dispatching them to any registered ActionListener objects. |
protected void |
processEvent(AWTEvent e)
Processes events on this button. |
void |
removeActionListener(ActionListener l)
Removes the specified action listener so that it no longer receives action events from this button. |
void |
setActionCommand(String command)
Sets the command name for the action event fired by this button. |
void |
setLabel(String label)
Sets the button's label to be the specified string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Button()
public Button(String label)
label
- A string label for the button.Method Detail |
public void addNotify()
public String getLabel()
null
if the button has no label.setLabel(java.lang.String)
public void setLabel(String label)
label
- the new label, or null
if the button has no label.getLabel()
public void setActionCommand(String command)
command
- A string used to set the button's
action command.
If the string is null
then the action command
is set to match the label of the button.ActionEvent
public String getActionCommand()
null
(default) then this method
returns the label of the button.public void addActionListener(ActionListener l)
l
- the action listenerActionListener
,
removeActionListener(java.awt.event.ActionListener)
public void removeActionListener(ActionListener l)
l
- the action listenerActionListener
,
addActionListener(java.awt.event.ActionListener)
public EventListener[] getListeners(Class listenerType)
listenerType
argument. For example, to get all of the ActionListener(s) for the
given Button b
, one would write:
ActionListener[] als = (ActionListener[])(b.getListeners(ActionListener.class))If no such listener list exists, then an empty array is returned.
getListeners
in class Component
listenerType
- Type of listeners requestedprotected void processEvent(AWTEvent e)
ActionEvent
, this method invokes
the processActionEvent
method. Otherwise,
it invokes processEvent
on the superclass.processEvent
in class Component
e
- the event.ActionEvent
,
processActionEvent(java.awt.event.ActionEvent)
protected void processActionEvent(ActionEvent e)
ActionListener
objects.
This method is not called unless action events are enabled for this button. Action events are enabled when one of the following occurs:
ActionListener
object is registered
via addActionListener
.
enableEvents
.
e
- the action event.ActionListener
,
addActionListener(java.awt.event.ActionListener)
,
Component.enableEvents(long)
protected String paramString()
paramString
in class Component
public AccessibleContext getAccessibleContext()
getAccessibleContext
in interface Accessible
getAccessibleContext
in class Component
|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.