<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.awt.Button
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.awt.html">This Package</a>  <a href="java.awt.BorderLayout.html#_top_">Previous</a>  <a href="java.awt.Canvas.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.awt.Button
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----<a href="java.awt.Component.html#_top_">java.awt.Component</a>
           |
           +----java.awt.Button
</pre>
<hr>
<dl>
  <dt> public class <b>Button</b>
  <dt> extends <a href="java.awt.Component.html#_top_">Component</a>
</dl>
This class creates a labeled button. The application can cause 
 some action to happen when the button is pushed. This image 
 depicts three views of a "<code>Quit</code>" button as it appears
 under the Solaris operating system: 
 <p> 
 <img src="images-awt/Button-1.gif"
 ALIGN=center HSPACE=10 VSPACE=7>  
 <p>
 The first view shows the button as it appears normally. 
 The second view shows the button 
 when it has input focus. Its outline is darkened to let the 
 user know that it is an active object. The third view shows the 
 button when the user clicks the mouse over the button, and thus 
 requests that an action be performed.
 <p>
 The gesture of clicking on a button with the mouse
 is associated with one instance of <code>ActionEvent</code>, 
 which is sent out when the mouse is both pressed and released 
 over the button. If an application is interested in knowing
 when the button has been pressed but not released, as a separate 
 gesture, it can specialize <code>processMouseEvent</code>, 
 or it can register itself as a listener for mouse events by
 calling <code>addMouseListener</code>. Both of these methods are
 defined by <code>Component</code>, the abstract superclass of
 all components.
 <p>
 When a button is pressed and released, AWT sends an instance  
 of <code>ActionEvent</code> to the button, by calling 
 <code>processEvent</code> on the button. The button's 
 <code>processEvent</code> method receives all events
 for the button; it passes an action event along by
 calling its own <code>processActionEvent</code> method.
 The latter method passes the action event on to any action
 listeners that have registered an interest in action
 events generated by this button.
 <p>
 If an application wants to perform some action based on  
 a button being pressed and released, it should implement 
 <code>ActionListener</code> and register the new listener 
 to receive events from this button, by calling the button's
 <code>addActionListener</code> method. The application can
 make use of the button's action command as a messaging protocol.
<p>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.event.ActionEvent.html#_top_">ActionEvent</a>, <a href="java.awt.event.ActionListener.html#_top_">ActionListener</a>, <a href="java.awt.Component.html#processMouseEvent">processMouseEvent</a>, <a href="java.awt.Component.html#addMouseListener">addMouseListener</a>
</dl>
<hr>
<a name="index"></a>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Button()"><b>Button</b></a>()
  <dd>  Constructs a Button with no label.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Button(java.lang.String)"><b>Button</b></a>(String)
  <dd>  Constructs a Button with the specified label.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#addActionListener(java.awt.event.ActionListener)"><b>addActionListener</b></a>(ActionListener)
  <dd>  Adds the specified action listener to receive action events from
 this button.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#addNotify()"><b>addNotify</b></a>()
  <dd>  Creates the peer of the button.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getActionCommand()"><b>getActionCommand</b></a>()
  <dd>  Returns the command name of the action event fired by this button.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getLabel()"><b>getLabel</b></a>()
  <dd>  Gets the label of this button.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#paramString()"><b>paramString</b></a>()
  <dd>  Returns the parameter string representing the state of this 
 button.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#processActionEvent(java.awt.event.ActionEvent)"><b>processActionEvent</b></a>(ActionEvent)
  <dd> 
 Processes action events occurring on this button 
 by dispatching them to any registered 
 <code>ActionListener</code> objects.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#processEvent(java.awt.AWTEvent)"><b>processEvent</b></a>(AWTEvent)
  <dd>  Processes events on this button.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#removeActionListener(java.awt.event.ActionListener)"><b>removeActionListener</b></a>(ActionListener)
  <dd>  Removes the specified action listener so that it no longer 
 receives action events from this button.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setActionCommand(java.lang.String)"><b>setActionCommand</b></a>(String)
  <dd>  Sets the command name for the action event fired 
 by this button.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setLabel(java.lang.String)"><b>setLabel</b></a>(String)
  <dd>  Sets the button's label to be the specified string.
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="Button"></a>
<a name="Button()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Button</b>
<pre>
 public Button()
</pre>
<dl>
  <dd> Constructs a Button with no label.
<p>
</dl>
<a name="Button(java.lang.String)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Button</b>
<pre>
 public Button(<a href="java.lang.String.html#_top_">String</a> label)
</pre>
<dl>
  <dd> Constructs a Button with the specified label.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> label - A string label for the button.
  </dl></dd>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="addNotify()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="addNotify"><b>addNotify</b></a>
<pre>
 public void addNotify()
</pre>
<dl>
  <dd> Creates the peer of the button.  The button's peer allows the
 application to change the look of the button without changing 
 its functionality.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.awt.Component.html#addNotify()">addNotify</a> in class <a href="java.awt.Component.html#_top_">Component</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Toolkit.html#createButton(java.awt.Button)">createButton</a>, <a href="java.awt.Component.html#getToolkit()">getToolkit</a>
  </dl></dd>
</dl>
<a name="getLabel()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getLabel"><b>getLabel</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> getLabel()
</pre>
<dl>
  <dd> Gets the label of this button.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the button's label, or <code>null</code>
                if the button has no label.
    <dt> <b>See Also:</b>
    <dd> <a href="#setLabel">setLabel</a>
  </dl></dd>
</dl>
<a name="setLabel(java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setLabel"><b>setLabel</b></a>
<pre>
 public synchronized void setLabel(<a href="java.lang.String.html#_top_">String</a> label)
</pre>
<dl>
  <dd> Sets the button's label to be the specified string.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> label - the new label, or <code>null</code>
                if the button has no label.
    <dt> <b>See Also:</b>
    <dd> <a href="#getLabel">getLabel</a>
  </dl></dd>
</dl>
<a name="setActionCommand(java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setActionCommand"><b>setActionCommand</b></a>
<pre>
 public void setActionCommand(<a href="java.lang.String.html#_top_">String</a> command)
</pre>
<dl>
  <dd> Sets the command name for the action event fired 
 by this button. By default this action command is 
 set to match the label of the button.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> command - A string used to set the button's
                  action command.
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.event.ActionEvent.html#_top_">ActionEvent</a>
  </dl></dd>
</dl>
<a name="getActionCommand()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getActionCommand"><b>getActionCommand</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> getActionCommand()
</pre>
<dl>
  <dd> Returns the command name of the action event fired by this button.
<p>
</dl>
<a name="addActionListener(java.awt.event.ActionListener)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="addActionListener"><b>addActionListener</b></a>
<pre>
 public synchronized void addActionListener(<a href="java.awt.event.ActionListener.html#_top_">ActionListener</a> l)
</pre>
<dl>
  <dd> Adds the specified action listener to receive action events from
 this button. Action events occur when a user presses or releases
 the mouse over this button.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> l - the action listener.
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.event.ActionListener.html#_top_">ActionListener</a>, <a href="#removeActionListener">removeActionListener</a>
  </dl></dd>
</dl>
<a name="removeActionListener(java.awt.event.ActionListener)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="removeActionListener"><b>removeActionListener</b></a>
<pre>
 public synchronized void removeActionListener(<a href="java.awt.event.ActionListener.html#_top_">ActionListener</a> l)
</pre>
<dl>
  <dd> Removes the specified action listener so that it no longer 
 receives action events from this button. Action events occur  
 when a user presses or releases the mouse over this button.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> l - the action listener.
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.event.ActionListener.html#_top_">ActionListener</a>, <a href="#addActionListener">addActionListener</a>
  </dl></dd>
</dl>
<a name="processEvent(java.awt.AWTEvent)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="processEvent"><b>processEvent</b></a>
<pre>
 protected void processEvent(<a href="java.awt.AWTEvent.html#_top_">AWTEvent</a> e)
</pre>
<dl>
  <dd> Processes events on this button. If an event is 
 an instance of <code>ActionEvent</code>, this method invokes  
 the <code>processActionEvent</code> method. Otherwise,
 it invokes <code>processEvent</code> on the superclass.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> e - the event.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.awt.Component.html#processEvent(java.awt.AWTEvent)">processEvent</a> in class <a href="java.awt.Component.html#_top_">Component</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.event.ActionEvent.html#_top_">ActionEvent</a>, <a href="#processActionEvent">processActionEvent</a>
  </dl></dd>
</dl>
<a name="processActionEvent(java.awt.event.ActionEvent)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="processActionEvent"><b>processActionEvent</b></a>
<pre>
 protected void processActionEvent(<a href="java.awt.event.ActionEvent.html#_top_">ActionEvent</a> e)
</pre>
<dl>
  <dd> Processes action events occurring on this button 
 by dispatching them to any registered 
 <code>ActionListener</code> objects.
 <p>
 This method is not called unless action events are 
 enabled for this button. Action events are enabled 
 when one of the following occurs:
 <p><ul>
 <li>An <code>ActionListener</code> object is registered 
 via <code>addActionListener</code>.
 <li>Action events are enabled via <code>enableEvents</code>.
 </ul>
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> e - the action event.
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.event.ActionListener.html#_top_">ActionListener</a>, <a href="#addActionListener">addActionListener</a>, <a href="java.awt.Component.html#enableEvents">enableEvents</a>
  </dl></dd>
</dl>
<a name="paramString()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="paramString"><b>paramString</b></a>
<pre>
 protected <a href="java.lang.String.html#_top_">String</a> paramString()
</pre>
<dl>
  <dd> Returns the parameter string representing the state of this 
 button. This string is useful for debugging.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the parameter string of this button.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.awt.Component.html#paramString()">paramString</a> in class <a href="java.awt.Component.html#_top_">Component</a>
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.awt.html">This Package</a>  <a href="java.awt.BorderLayout.html#_top_">Previous</a>  <a href="java.awt.Canvas.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
