mouseevent.html

来自「API資料大全」· HTML 代码 · 共 689 行 · 第 1/3 页

HTML
689
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:33:29 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class  MouseEvent</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_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>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/MouseEvent.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../../java/awt/event/MouseAdapter.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../java/awt/event/MouseMotionAdapter.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>  &nbsp;&nbsp;<A HREF="MouseEvent.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.awt.event</FONT><BR>Class  MouseEvent</H2><PRE><A HREF="../../../java/lang/Object.html">java.lang.Object</A>  |  +--<A HREF="../../../java/util/EventObject.html">java.util.EventObject</A>        |        +--<A HREF="../../../java/awt/AWTEvent.html">java.awt.AWTEvent</A>              |              +--<A HREF="../../../java/awt/event/ComponentEvent.html">java.awt.event.ComponentEvent</A>                    |                    +--<A HREF="../../../java/awt/event/InputEvent.html">java.awt.event.InputEvent</A>                          |                          +--<B>java.awt.event.MouseEvent</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../java/io/Serializable.html">Serializable</A></DD></DL><DL><DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../javax/swing/event/MenuDragMouseEvent.html">MenuDragMouseEvent</A></DD></DL><HR><DL><DT>public class <B>MouseEvent</B><DT>extends <A HREF="../../../java/awt/event/InputEvent.html">InputEvent</A></DL><P>/** An event which indicates that a mouse action occurred in a component. This event is used both for mouse events (click, enter, exit) and mouse  motion events (moves and drags).  <P> This low-level event is generated by a component object for: <ul> <li>Mouse Events     <ul>     <li>a mouse button is pressed     <li>a mouse button is released     <li>a mouse button is clicked (pressed and released)     <li>the mouse cursor enters a component     <li>the mouse cursor exits a component     </ul> <li> Mouse Motion Events     <ul>     <li>the mouse is moved     <li>the mouse is dragged     </ul> </ul> <P> A MouseEvent object is passed to every <code>MouseListener</code> or <code>MouseAdapter</code> object which registered to receive  the "interesting" mouse events using the component's  <code>addMouseListener</code> method. (<code>MouseAdapter</code> objects implement the  <code>MouseListener</code> interface.) Each such listener object  gets a <code>MouseEvent</code> containing the mouse event. <P> A MouseEvent object is also passed to every <code>MouseMotionListener</code> or <code>MouseMotionAdapter</code> object which registered to receive  mouse motion events using the component's <code>addMouseMotionListener</code> method. (<code>MouseMotionAdapter</code> objects implement the  <code>MouseMotionListener</code> interface.) Each such listener object  gets a <code>MouseEvent</code> containing the mouse motion event. <P> When a mouse button is clicked, events are generated and sent to the registered MouseListeners, with the button mask set in the modifier field. For example, if the first mouse button is pressed, events are sent in the following order: <PRE>    MOUSE_PRESSED:  BUTTON1_MASK    MOUSE_RELEASED: BUTTON1_MASK    MOUSE_CLICKED:  BUTTON1_MASK </PRE> When multiple mouse buttons are pressed, each press, release, and click results in a separate event. The button mask in the modifier field reflects only the button that changed state, not the current state of all buttons. <P>  For example, if the user presses button 1 followed by button 2 and releases them in the same order, the following sequence of events is generated: <PRE>    MOUSE_PRESSED:  BUTTON1_MASK    MOUSE_PRESSED:  BUTTON2_MASK    MOUSE_RELEASED: BUTTON1_MASK    MOUSE_CLICKED:  BUTTON1_MASK    MOUSE_RELEASED: BUTTON2_MASK    MOUSE_CLICKED:  BUTTON2_MASK </PRE> If button2 is released first, the MOUSE_RELEASED/MOUSE_CLICKED pair for BUTTON2_MASK arrives first, followed by the pair for BUTTON1_MASK.<P><DL><DT><B>Since: </B><DD>1.1</DD><DT><B>See Also: </B><DD><A HREF="../../../java/awt/event/MouseAdapter.html"><CODE>MouseAdapter</CODE></A>, <A HREF="../../../java/awt/event/MouseListener.html"><CODE>MouseListener</CODE></A>, <A HREF="../../../java/awt/event/MouseMotionAdapter.html"><CODE>MouseMotionAdapter</CODE></A>, <A HREF="../../../java/awt/event/MouseMotionListener.html"><CODE>MouseMotionListener</CODE></A>, <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/mouselistener.html">Tutorial: Writing a Mouse Listener</a>, <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/mousemotionlistener.html">Tutorial: Writing a Mouse Motion Listener</a>, <a href="http://www.awl.com/cp/javaseries/jcl1_2.html">Reference: The Java Class Libraries (update file)</a>, <A HREF="../../../serialized-form.html#java.awt.event.MouseEvent">Serialized Form</A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/event/MouseEvent.html#MOUSE_CLICKED">MOUSE_CLICKED</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The "mouse clicked" event.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/event/MouseEvent.html#MOUSE_DRAGGED">MOUSE_DRAGGED</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The "mouse dragged" event.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/event/MouseEvent.html#MOUSE_ENTERED">MOUSE_ENTERED</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The "mouse entered" event.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/event/MouseEvent.html#MOUSE_EXITED">MOUSE_EXITED</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The "mouse exited" event.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/event/MouseEvent.html#MOUSE_FIRST">MOUSE_FIRST</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The first number in the range of ids used for mouse events.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/event/MouseEvent.html#MOUSE_LAST">MOUSE_LAST</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The last number in the range of ids used for mouse events.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/awt/event/MouseEvent.html#MOUSE_MOVED">MOUSE_MOVED</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The "mouse moved" event.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?