    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.

##

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

##

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

##

Button

      public Button()

  Constructs a Button with no label.

Button

      public Button(String label)

  Constructs a Button with the specified label.

  Parameters:
    label - the label of the button

##

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

getLabel

      public String getLabel()

  Gets the label of the button.

  See Also:
    setLabel

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

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.

getActionCommand

      public String getActionCommand()

  Returns the command name of the action event fired by this button.

addActionListener

      public void addActionListener(ActionListener l)

  Adds the specified action listener to receive action events from this button.

  Parameters:
    l - the action listener

removeActionListener

      public void removeActionListener(ActionListener l)

  Removes the specified action listener so it no longer receives action events from this button.

  Parameters:
    l - the action listener

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

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

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