📄 sensorevent.html
字号:
<HR><A NAME="DRAGGED"><!-- --></A><H3>DRAGGED</H3><PRE>public static final int <B>DRAGGED</B></PRE><DL><DD>A button dragged event.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../../../../constant-values.html#com.sun.j3d.utils.behaviors.sensor.SensorEvent.DRAGGED">Constant Field Values</A></DL></DL><HR><A NAME="READ"><!-- --></A><H3>READ</H3><PRE>public static final int <B>READ</B></PRE><DL><DD>A sensor read event.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../../../../constant-values.html#com.sun.j3d.utils.behaviors.sensor.SensorEvent.READ">Constant Field Values</A></DL></DL><HR><A NAME="NOBUTTON"><!-- --></A><H3>NOBUTTON</H3><PRE>public static final int <B>NOBUTTON</B></PRE><DL><DD>The value that is returned by <code>getButton</code> when no buttons have changed state.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../../../../constant-values.html#com.sun.j3d.utils.behaviors.sensor.SensorEvent.NOBUTTON">Constant Field Values</A></DL></DL><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TH></TR></TABLE><A NAME="SensorEvent(java.lang.Object, int, javax.media.j3d.Sensor, javax.media.j3d.Transform3D, int[], int, long, long)"><!-- --></A><H3>SensorEvent</H3><PRE>public <B>SensorEvent</B>(java.lang.Object source, int id, <A HREF="../../../../../../javax/media/j3d/Sensor.html" title="class in javax.media.j3d">Sensor</A> sensor, <A HREF="../../../../../../javax/media/j3d/Transform3D.html" title="class in javax.media.j3d">Transform3D</A> sensorRead, int[] buttonState, int button, long time, long lastTime)</PRE><DL><DD>Creates a new <code>SensorEvent</code>.<P><DL><DT><B>Parameters:</B><DD><CODE>source</CODE> - a reference to the originating object which instantiated the <code>SensorEventAgent</code>, usually a <code>Behavior</code>; may be null<DD><CODE>id</CODE> - event type<DD><CODE>sensor</CODE> - a reference to the provoking sensor<DD><CODE>sensorRead</CODE> - the sensor's read value at the time of the event<DD><CODE>buttonState</CODE> - the state of the sensor's buttons at the time of the event, where a 1 in the array indicates that the button at that index is down, and a 0 indicates that button is up; may be null<DD><CODE>button</CODE> - index of the button that changed state, from 0 to <code>(buttonCount - 1)</code>, or the value <code>NOBUTTON</code><DD><CODE>time</CODE> - the time in nanoseconds at which the <code>dispatchEvents</code> method of <code>SensorEventAgent</code> was called to generate this event, usually from the <code>processStimulus</code> method of a Behavior<DD><CODE>lastTime</CODE> - the time in nanoseconds at which the <code>dispatchEvents</code> method of <code>SensorEventAgent</code> was <i>last</i> called to generate events, usually from the <code>processStimulus</code> method of a <code>Behavior</code>; may be used to measure frame time in behaviors that wake up every frame</DL></DL><HR><A NAME="SensorEvent()"><!-- --></A><H3>SensorEvent</H3><PRE>public <B>SensorEvent</B>()</PRE><DL><DD>Creates a new <i>ephemeral</i> <code>SensorEvent</code>. In order to avoid creating large numbers of sensor event objects, the events passed to the button and read listeners by the <code>dispatchEvents</code> method of <code>SensorEventAgent</code> are valid only until the listener returns. If the event needs to be retained then they must be copied with the <code>SensorEvent(SensorEvent)</code> constructor.<P></DL><HR><A NAME="SensorEvent(com.sun.j3d.utils.behaviors.sensor.SensorEvent)"><!-- --></A><H3>SensorEvent</H3><PRE>public <B>SensorEvent</B>(<A HREF="../../../../../../com/sun/j3d/utils/behaviors/sensor/SensorEvent.html" title="class in com.sun.j3d.utils.behaviors.sensor">SensorEvent</A> e)</PRE><DL><DD>Creates a copy of the given <code>SensorEvent</code>. Listeners must use this constructor to copy events that need to be retained. NOTE: The <code>Sensor</code> and <code>Object</code> references returned by <code>getSensor</code> and <code>getSource</code> remain references to the original objects.<P><DL><DT><B>Parameters:</B><DD><CODE>e</CODE> - the event to be copied</DL></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="set(java.lang.Object, int, javax.media.j3d.Sensor, javax.media.j3d.Transform3D, int[], int, long, long)"><!-- --></A><H3>set</H3><PRE>public void <B>set</B>(java.lang.Object source, int id, <A HREF="../../../../../../javax/media/j3d/Sensor.html" title="class in javax.media.j3d">Sensor</A> sensor, <A HREF="../../../../../../javax/media/j3d/Transform3D.html" title="class in javax.media.j3d">Transform3D</A> sensorRead, int[] buttonState, int button, long time, long lastTime)</PRE><DL><DD>Sets the fields of an ephemeral event. No objects are copied. An <code>IllegalStateException</code> will be thrown if this event is not ephemeral.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>source</CODE> - a reference to the originating object which instantiated the <code>SensorEventAgent</code>, usually a <code>Behavior</code>; may be null<DD><CODE>id</CODE> - event type<DD><CODE>sensor</CODE> - a reference to the provoking sensor<DD><CODE>sensorRead</CODE> - the sensor's read value at the time of the event<DD><CODE>buttonState</CODE> - the state of the sensor's buttons at the time of the event; a 1 in the array indicates that the button at that index is down, while a 0 indicates that button is up<DD><CODE>button</CODE> - index of the button that changed state, from 0 to <code>(buttonCount - 1)</code>, or the value <code>NOBUTTON</code><DD><CODE>time</CODE> - the time in nanoseconds at which the <code>dispatchEvents</code> method of <code>SensorEventAgent</code> was called to generate this event, usually from the <code>processStimulus</code> method of a Behavior<DD><CODE>lastTime</CODE> - the time in nanoseconds at which the <code>dispatchEvents</code> method of <code>SensorEventAgent</code> was <i>last</i> called to generate events, usually from the <code>processStimulus</code> method of a <code>Behavior</code>; may be used to measure frame time in behaviors that wake up every frame</DL></DD></DL><HR><A NAME="getSource()"><!-- --></A><H3>getSource</H3><PRE>public java.lang.Object <B>getSource</B>()</PRE><DL><DD>Gets a reference to the originating object which instantiated the <code>SensorEventAgent</code>, usually a <code>Behavior</code>; may be null.<P><DD><DL><DT><B>Returns:</B><DD>the originating object</DL></DD></DL><HR><A NAME="getID()"><!-- --></A><H3>getID</H3><PRE>public int <B>getID</B>()</PRE><DL><DD>Gets the event type.<P><DD><DL><DT><B>Returns:</B><DD>the event id</DL></DD></DL><HR><A NAME="getSensor()"><!-- --></A><H3>getSensor</H3><PRE>public <A HREF="../../../../../../javax/media/j3d/Sensor.html" title="class in javax.media.j3d">Sensor</A> <B>getSensor</B>()</PRE><DL><DD>Gets a reference to the provoking sensor.<P><DD><DL><DT><B>Returns:</B><DD>the provoking sensor</DL></DD></DL><HR><A NAME="getTime()"><!-- --></A><H3>getTime</H3><PRE>public long <B>getTime</B>()</PRE><DL><DD>Gets the time in nanoseconds at which the <code>dispatchEvents</code> method of <code>SensorEventAgent</code> was called to generate this event, usually from the <code>processStimulus</code> method of a <code>Behavior</code>.<P><DD><DL><DT><B>Returns:</B><DD>time in nanoseconds</DL></DD></DL><HR><A NAME="getLastTime()"><!-- --></A><H3>getLastTime</H3><PRE>public long <B>getLastTime</B>()</PRE><DL><DD>Gets the time in nanoseconds at which the <code>dispatchEvents</code> method of <code>SensorEventAgent</code> was <i>last</i> called to generate events, usually from the <code>processStimulus</code> method of a <code>Behavior</code>; may be used to measure frame time in behaviors that wake up every frame.<P><DD><DL><DT><B>Returns:</B><DD>last time in nanoseconds</DL></DD></DL><HR><A NAME="getSensorRead(javax.media.j3d.Transform3D)"><!-- --></A><H3>getSensorRead</H3><PRE>public void <B>getSensorRead</B>(<A HREF="../../../../../../javax/media/j3d/Transform3D.html" title="class in javax.media.j3d">Transform3D</A> t)</PRE><DL><DD>Copies the sensor's read value at the time of the event into the given <code>Transform3D</code>.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>t</CODE> - the transform to receive the sensor read</DL></DD></DL><HR><A NAME="getButton()"><!-- --></A><H3>getButton</H3><PRE>public int <B>getButton</B>()</PRE><DL><DD>Gets the index of the button that changed state when passed to a <code>pressed</code> or <code>released</code> callback. The index may range from 0 to <code>(sensor.getSensorButtonCount() - 1)</code>. The value returned is <code>NOBUTTON</code> for events passed to a <code>read</code> or <code>dragged</code> callback.<P><DD><DL><DT><B>Returns:</B><DD>the button index</DL></DD></DL><HR><A NAME="getButtonState(int[])"><!-- --></A><H3>getButtonState</H3><PRE>public void <B>getButtonState</B>(int[] buttonState)</PRE><DL><DD>Copies the state of the sensor's buttons at the time of the event into the given array. A 1 in the array indicates that the button at that index is down, while a 0 indicates that button is up.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>buttonState</CODE> - the state of the sensor buttons</DL></DD></DL><HR><A NAME="isEphemeral()"><!-- --></A><H3>isEphemeral</H3><PRE>public boolean <B>isEphemeral</B>()</PRE><DL><DD>Returns true if this event is <i>ephemeral</i> and is valid only until the listener returns. A copy of the event can be created by passing it to the <code>SensorEvent(SensorEvent)</code> constructor.<P><DD><DL></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <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="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-all.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></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../com/sun/j3d/utils/behaviors/sensor/SensorButtonListener.html" title="interface in com.sun.j3d.utils.behaviors.sensor"><B>PREV CLASS</B></A> <A HREF="../../../../../../com/sun/j3d/utils/behaviors/sensor/SensorEventAgent.html" title="class in com.sun.j3d.utils.behaviors.sensor"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?com/sun/j3d/utils/behaviors/sensor/SensorEvent.html" target="_top"><B>FRAMES</B></A> <A HREF="SensorEvent.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | <A HREF="#field_summary">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: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR><font size="-1">Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to <a href="../../../../../../LICENSE-SPEC.html">license terms</a>.</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -