button.html
字号:
</DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>command</CODE> - A string used to set the button's action command. If the string is <code>null</code> then the action command is set to match the label of the button.<DT><B>Since: </B><DD>JDK1.1</DD><DT><B>See Also: </B><DD><A HREF="../../java/awt/event/ActionEvent.html"><CODE>ActionEvent</CODE></A></DL></DD></DL><HR><A NAME="getActionCommand()"><!-- --></A><H3>getActionCommand</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>getActionCommand</B>()</PRE><DL><DD>Returns the command name of the action event fired by this button. If the command name is <code>null</code> (default) then this method returns the label of the button.<DD><DL></DL></DD></DL><HR><A NAME="addActionListener(java.awt.event.ActionListener)"><!-- --></A><H3>addActionListener</H3><PRE>public void <B>addActionListener</B>(<A HREF="../../java/awt/event/ActionListener.html">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. If l is null, no exception is thrown and no action is performed.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>l</CODE> - the action listener<DT><B>Since: </B><DD>JDK1.1</DD><DT><B>See Also: </B><DD><A HREF="../../java/awt/event/ActionListener.html"><CODE>ActionListener</CODE></A>, <A HREF="../../java/awt/Button.html#removeActionListener(java.awt.event.ActionListener)"><CODE>removeActionListener(java.awt.event.ActionListener)</CODE></A></DL></DD></DL><HR><A NAME="removeActionListener(java.awt.event.ActionListener)"><!-- --></A><H3>removeActionListener</H3><PRE>public void <B>removeActionListener</B>(<A HREF="../../java/awt/event/ActionListener.html">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. If l is null, no exception is thrown and no action is performed.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>l</CODE> - the action listener<DT><B>Since: </B><DD>JDK1.1</DD><DT><B>See Also: </B><DD><A HREF="../../java/awt/event/ActionListener.html"><CODE>ActionListener</CODE></A>, <A HREF="../../java/awt/Button.html#addActionListener(java.awt.event.ActionListener)"><CODE>addActionListener(java.awt.event.ActionListener)</CODE></A></DL></DD></DL><HR><A NAME="getListeners(java.lang.Class)"><!-- --></A><H3>getListeners</H3><PRE>public <A HREF="../../java/util/EventListener.html">EventListener</A>[] <B>getListeners</B>(<A HREF="../../java/lang/Class.html">Class</A> listenerType)</PRE><DL><DD>Return an array of all the listeners that were added to the Button with addXXXListener(), where XXX is the name of the <code>listenerType</code> argument. For example, to get all of the ActionListener(s) for the given Button <code>b</code>, one would write: <pre> ActionListener[] als = (ActionListener[])(b.getListeners(ActionListener.class)) </pre> If no such listener list exists, then an empty array is returned.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/awt/Component.html#getListeners(java.lang.Class)">getListeners</A></CODE> in class <CODE><A HREF="../../java/awt/Component.html">Component</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>listenerType</CODE> - Type of listeners requested<DT><B>Returns:</B><DD>all of the listeners of the specified type supported by this button<DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="processEvent(java.awt.AWTEvent)"><!-- --></A><H3>processEvent</H3><PRE>protected void <B>processEvent</B>(<A HREF="../../java/awt/AWTEvent.html">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.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/awt/Component.html#processEvent(java.awt.AWTEvent)">processEvent</A></CODE> in class <CODE><A HREF="../../java/awt/Component.html">Component</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>e</CODE> - the event.<DT><B>Since: </B><DD>JDK1.1</DD><DT><B>See Also: </B><DD><A HREF="../../java/awt/event/ActionEvent.html"><CODE>ActionEvent</CODE></A>, <A HREF="../../java/awt/Button.html#processActionEvent(java.awt.event.ActionEvent)"><CODE>processActionEvent(java.awt.event.ActionEvent)</CODE></A></DL></DD></DL><HR><A NAME="processActionEvent(java.awt.event.ActionEvent)"><!-- --></A><H3>processActionEvent</H3><PRE>protected void <B>processActionEvent</B>(<A HREF="../../java/awt/event/ActionEvent.html">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><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>e</CODE> - the action event.<DT><B>Since: </B><DD>JDK1.1</DD><DT><B>See Also: </B><DD><A HREF="../../java/awt/event/ActionListener.html"><CODE>ActionListener</CODE></A>, <A HREF="../../java/awt/Button.html#addActionListener(java.awt.event.ActionListener)"><CODE>addActionListener(java.awt.event.ActionListener)</CODE></A>, <A HREF="../../java/awt/Component.html#enableEvents(long)"><CODE>Component.enableEvents(long)</CODE></A></DL></DD></DL><HR><A NAME="paramString()"><!-- --></A><H3>paramString</H3><PRE>protected <A HREF="../../java/lang/String.html">String</A> <B>paramString</B>()</PRE><DL><DD>Returns the parameter string representing the state of this button. This string is useful for debugging.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/awt/Component.html#paramString()">paramString</A></CODE> in class <CODE><A HREF="../../java/awt/Component.html">Component</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the parameter string of this button.</DL></DD></DL><HR><A NAME="getAccessibleContext()"><!-- --></A><H3>getAccessibleContext</H3><PRE>public <A HREF="../../javax/accessibility/AccessibleContext.html">AccessibleContext</A> <B>getAccessibleContext</B>()</PRE><DL><DD>Gets the AccessibleContext associated with this Button. For buttons, the AccessibleContext takes the form of an AccessibleAWTButton. A new AccessibleAWTButton instance is created if necessary.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../javax/accessibility/Accessible.html#getAccessibleContext()">getAccessibleContext</A></CODE> in interface <CODE><A HREF="../../javax/accessibility/Accessible.html">Accessible</A></CODE><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/awt/Component.html#getAccessibleContext()">getAccessibleContext</A></CODE> in class <CODE><A HREF="../../java/awt/Component.html">Component</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>an AccessibleAWTButton that serves as the AccessibleContext of this Button</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Button.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../java/awt/BorderLayout.html"><B>PREV CLASS</B></A> <A HREF="../../java/awt/Button.AccessibleAWTButton.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Button.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#inner_class_summary">INNER</A> | <A HREF="#fields_inherited_from_class_java.awt.Component">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -