java.awt
Class Button
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Button
All Implemented Interfaces:
Serializable, ImageObserver, MenuContainer, Serializable
This class provides a button widget for the AWT.
Authors:- Aaron M. Renn (arenn@urbanophile.com)
- Tom Tromey <tromey@cygnus.com>
Button
public Button()
Initializes a new instance of Button
with no label.
Throws:
Button
public Button(java.lang.String label)
Initializes a new instance of Button
with the specified
label. The action command name is also initialized to this value.
Parameters:
Throws:
addActionListener
public synchronized void addActionListener(java.awt.event.ActionListener listener)
Adds a new entry to the list of listeners that will receive
action events from this button.
Parameters:
addNotify
public void addNotify()
Notifies this button that it should create its native peer object.
getActionCommand
public String getActionCommand()
Returns the action command name for this button.
Returns:
- The action command name for this button.
getActionListeners
public synchronized ActionListener[] getActionListeners()
getLabel
public String getLabel()
Returns the label for this button.
Returns:
- The label for this button.
getListeners
public 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.
Since:Parameters:
Throws:
ClassCastException
- If listenerType doesn't specify a class or
interface that implements @see java.util.EventListener.
paramString
protected String paramString()
Returns a debugging string for this button.
Returns:
- A debugging string for this button.
processActionEvent
protected void processActionEvent(java.awt.event.ActionEvent event)
This method dispatches an action event for this button to any
registered listeners.
Parameters:
processEvent
protected void processEvent(java.awt.AWTEvent event)
Processes an event for this button. If the specified event is an
instance of 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.
Parameters:
removeActionListener
public synchronized void removeActionListener(java.awt.event.ActionListener listener)
Removes the specified listener from the list of listeners that will
receive action events from this button.
Parameters:
setActionCommand
public void setActionCommand(java.lang.String actionCommand)
Sets the action command name for this button to the specified value.
Parameters:
setLabel
public synchronized void setLabel(java.lang.String label)
Sets the label for this button to the specified value.
Parameters: