All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.awt.Button

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Button

public class Button
extends Component
A class that produces a labeled button component.


Constructor Index

 o Button()
Constructs a Button with no label.
 o Button(String)
Constructs a Button with the specified label.

Method Index

 o addActionListener(ActionListener)
Adds the specified action listener to receive action events from this button.
 o addNotify()
Creates the peer of the button.
 o getActionCommand()
Returns the command name of the action event fired by this button.
 o getLabel()
Gets the label of the button.
 o paramString()
Returns the parameter String of this button.
 o processActionEvent(ActionEvent)
Processes action events occurring on this button by dispatching them to any registered ActionListener objects.
 o processEvent(AWTEvent)
Processes events on this button.
 o removeActionListener(ActionListener)
Removes the specified action listener so it no longer receives action events from this button.
 o setActionCommand(String)
Sets the command name of the action event fired by this button.
 o setLabel(String)
Sets the button with the specified label.

Constructors

 o Button
 public Button()
Constructs a Button with no label.

 o Button
 public Button(String label)
Constructs a Button with the specified label.

Parameters:
label - the label of the button

Methods

 o addNotify
 public void addNotify()
Creates the peer of the button. This peer allows us to change the look of the button without changing its functionality.

Overrides:
addNotify in class Component
 o getLabel
 public String getLabel()
Gets the label of the button.

See Also:
setLabel
 o setLabel
 public synchronized void setLabel(String label)
Sets the button with the specified label.

Parameters:
label - the label to set the button with
See Also:
getLabel
 o setActionCommand
 public void setActionCommand(String command)
Sets the command name of the action event fired by this button. By default this will be set to the label of the button.

 o getActionCommand
 public String getActionCommand()
Returns the command name of the action event fired by this button.

 o addActionListener
 public synchronized void addActionListener(ActionListener l)
Adds the specified action listener to receive action events from this button.

Parameters:
l - the action listener
 o removeActionListener
 public synchronized void removeActionListener(ActionListener l)
Removes the specified action listener so it no longer receives action events from this button.

Parameters:
l - the action listener
 o processEvent
 protected void processEvent(AWTEvent e)
Processes events on this button. If the event is an ActionEvent, it invokes the processActionEvent method, else it invokes its superclass's processEvent.

Parameters:
e - the event
Overrides:
processEvent in class Component
 o processActionEvent
 protected void processActionEvent(ActionEvent e)
Processes action events occurring on this button by dispatching them to any registered ActionListener objects. NOTE: This method will not be called unless action events are enabled for this component; this happens when one of the following occurs: a) An ActionListener object is registered via addActionListener() b) Action events are enabled via enableEvents()

Parameters:
e - the action event
See Also:
enableEvents
 o paramString
 protected String paramString()
Returns the parameter String of this button.

Overrides:
paramString in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index

Submit a bug or feature