📄 canvas.html
字号:
<DD>keyCode for ITU-T key <code>1</code>. <P>Constant value <code>49</code> is set to <code>KEY_NUM1</code>.</P></DL>
<HR>
<A NAME="KEY_NUM2"><!-- --></A><H3>
KEY_NUM2</H3>
<PRE>
public static final int <B>KEY_NUM2</B></PRE>
<DL>
<DD>keyCode for ITU-T key <code>2</code>. <P>Constant value <code>50</code> is set to <code>KEY_NUM2</code>.</P></DL>
<HR>
<A NAME="KEY_NUM3"><!-- --></A><H3>
KEY_NUM3</H3>
<PRE>
public static final int <B>KEY_NUM3</B></PRE>
<DL>
<DD>keyCode for ITU-T key <code>3</code>. <P>Constant value <code>51</code> is set to <code>KEY_NUM3</code>.</P></DL>
<HR>
<A NAME="KEY_NUM4"><!-- --></A><H3>
KEY_NUM4</H3>
<PRE>
public static final int <B>KEY_NUM4</B></PRE>
<DL>
<DD>keyCode for ITU-T key <code>4</code>. <P>Constant value <code>52</code> is set to <code>KEY_NUM4</code>.</P></DL>
<HR>
<A NAME="KEY_NUM5"><!-- --></A><H3>
KEY_NUM5</H3>
<PRE>
public static final int <B>KEY_NUM5</B></PRE>
<DL>
<DD>keyCode for ITU-T key <code>5</code>. <P>Constant value <code>53</code> is set to <code>KEY_NUM5</code>.</P></DL>
<HR>
<A NAME="KEY_NUM6"><!-- --></A><H3>
KEY_NUM6</H3>
<PRE>
public static final int <B>KEY_NUM6</B></PRE>
<DL>
<DD>keyCode for ITU-T key <code>6</code>. <P>Constant value <code>54</code> is set to <code>KEY_NUM6</code>.</P></DL>
<HR>
<A NAME="KEY_NUM7"><!-- --></A><H3>
KEY_NUM7</H3>
<PRE>
public static final int <B>KEY_NUM7</B></PRE>
<DL>
<DD>keyCode for ITU-T key <code>7</code>. <P>Constant value <code>55</code> is set to <code>KEY_NUM7</code>.</P></DL>
<HR>
<A NAME="KEY_NUM8"><!-- --></A><H3>
KEY_NUM8</H3>
<PRE>
public static final int <B>KEY_NUM8</B></PRE>
<DL>
<DD>keyCode for ITU-T key <code>8</code>. <P>Constant value <code>56</code> is set to <code>KEY_NUM8</code>.</P></DL>
<HR>
<A NAME="KEY_NUM9"><!-- --></A><H3>
KEY_NUM9</H3>
<PRE>
public static final int <B>KEY_NUM9</B></PRE>
<DL>
<DD>keyCode for ITU-T key <code>9</code>. <P>Constant value <code>57</code> is set to <code>KEY_NUM09</code>.</P></DL>
<HR>
<A NAME="KEY_STAR"><!-- --></A><H3>
KEY_STAR</H3>
<PRE>
public static final int <B>KEY_STAR</B></PRE>
<DL>
<DD>keyCode for ITU-T key "star" (<code>*</code>). <P>Constant value <code>42</code> is set to <code>KEY_STAR</code>.</P></DL>
<HR>
<A NAME="KEY_POUND"><!-- --></A><H3>
KEY_POUND</H3>
<PRE>
public static final int <B>KEY_POUND</B></PRE>
<DL>
<DD>keyCode for ITU-T key "pound" (<code>#</code>). <P>Constant value <code>35</code> is set to <code>KEY_POUND</code>.</P></DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="Canvas()"><!-- --></A><H3>
Canvas</H3>
<PRE>
protected <B>Canvas</B>()</PRE>
<DL>
<DD>Constructs a new <code>Canvas</code> object.</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="isDoubleBuffered()"><!-- --></A><H3>
isDoubleBuffered</H3>
<PRE>
public boolean <B>isDoubleBuffered</B>()</PRE>
<DL>
<DD>Checks if the <code>Canvas</code> is double buffered by the implementation.<DD><DL>
<DT><B>Returns:</B><DD><code>true</code> if double buffered, <code>false</code> otherwise</DL>
</DD>
</DL>
<HR>
<A NAME="hasPointerEvents()"><!-- --></A><H3>
hasPointerEvents</H3>
<PRE>
public boolean <B>hasPointerEvents</B>()</PRE>
<DL>
<DD>Checks if the platform supports pointer press and release events.<DD><DL>
<DT><B>Returns:</B><DD><code>true</code> if the device supports pointer events</DL>
</DD>
</DL>
<HR>
<A NAME="hasPointerMotionEvents()"><!-- --></A><H3>
hasPointerMotionEvents</H3>
<PRE>
public boolean <B>hasPointerMotionEvents</B>()</PRE>
<DL>
<DD>Checks if the platform supports pointer motion events (pointer dragged). Applications may use this method to determine if the platform is capable of supporting motion events.<DD><DL>
<DT><B>Returns:</B><DD><code>true</code> if the device supports pointer motion events</DL>
</DD>
</DL>
<HR>
<A NAME="hasRepeatEvents()"><!-- --></A><H3>
hasRepeatEvents</H3>
<PRE>
public boolean <B>hasRepeatEvents</B>()</PRE>
<DL>
<DD>Checks if the platform can generate repeat events when key is kept down.<DD><DL>
<DT><B>Returns:</B><DD><code>true</code> if the device supports repeat events</DL>
</DD>
</DL>
<HR>
<A NAME="getKeyCode(int)"><!-- --></A><H3>
getKeyCode</H3>
<PRE>
public int <B>getKeyCode</B>(int gameAction)</PRE>
<DL>
<DD>Gets a key code that corresponds to the specified game action on the device. The implementation is required to provide a mapping for every game action, so this method will always return a valid key code for every game action. See <a href="#gameactions">above</a> for further discussion of game actions. There may be multiple keys associated with the same game action; however, this method will return only one of them. Applications should translate the key code of every key event into a game action using <A HREF="../../../javax/microedition/lcdui/Canvas.html#getGameAction(int)"><CODE>getGameAction(int)</CODE></A> and then interpret the resulting game action, instead of generating a table of key codes at using this method during initialization. <P>The mapping between key codes and game actions will not change during the execution of the application.</P><DD><DL>
<DT><B>Parameters:</B><DD><CODE>gameAction</CODE> - the game action<DT><B>Returns:</B><DD>a key code corresponding to this game action<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <code>gameAction</code> is not a valid game action</DL>
</DD>
</DL>
<HR>
<A NAME="getKeyName(int)"><!-- --></A><H3>
getKeyName</H3>
<PRE>
public <A HREF="../../../java/lang/String.html">String</A> <B>getKeyName</B>(int keyCode)</PRE>
<DL>
<DD>Gets an informative key string for a key. The string returned will resemble the text physically printed on the key. This string is suitable for displaying to the user. For example, on a device with function keys <code>F1</code> through <code>F4</code>, calling this method on the <code>keyCode</code> for the <code>F1</code> key will return the string "<code>F1</code>". A typical use for this string will be to compose help text such as "Press <code>F1</code> to proceed." <p> This method will return a non-empty string for every valid key code. </p> <p> There is no direct mapping from game actions to key names. To get the string name for a game action <code>GAME_A</code>, the application must call </p> <TABLE BORDER="2"> <TR> <TD ROWSPAN="1" COLSPAN="1"> <pre><code> getKeyName(getKeyCode(GAME_A)); </code></pre> </TD> </TR> </TABLE><DD><DL>
<DT><B>Parameters:</B><DD><CODE>keyCode</CODE> - the key code being requested<DT><B>Returns:</B><DD>a string name for the key<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <code>keyCode</code> is not a valid key code</DL>
</DD>
</DL>
<HR>
<A NAME="getGameAction(int)"><!-- --></A><H3>
getGameAction</H3>
<PRE>
public int <B>getGameAction</B>(int keyCode)</PRE>
<DL>
<DD>Gets the game action associated with the given key code of the device. Returns zero if no game action is associated with this key code. See <a href="#gameactions">above</a> for further discussion of game actions. <P>The mapping between key codes and game actions will not change during the execution of the application.</P><DD><DL>
<DT><B>Parameters:</B><DD><CODE>keyCode</CODE> - the key code<DT><B>Returns:</B><DD>the game action corresponding to this key, or <code>0</code> if none<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if <code>keyCode</code> is not a valid key code</DL>
</DD>
</DL>
<HR>
<A NAME="setFullScreenMode(boolean)"><!-- --></A><H3>
setFullScreenMode</H3>
<PRE>
public void <B>setFullScreenMode</B>(boolean mode)</PRE>
<DL>
<DD>Controls whether the <code>Canvas</code> is in full-screen mode or in normal mode.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>mode</CODE> - <code>true</code> if the <code>Canvas</code> is to be in full screen mode, <code>false</code> otherwise<DT><B>Since: </B><DD>MIDP 2.0</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="keyPressed(int)"><!-- --></A><H3>
keyPressed</H3>
<PRE>
protected void <B>keyPressed</B>(int keyCode)</PRE>
<DL>
<DD>Called when a key is pressed. <P>The <code>getGameAction()</code> method can be called to determine what game action, if any, is mapped to the key. Class <code>Canvas</code> has an empty implementation of this method, and the subclass has to redefine it if it wants to listen this method.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>keyCode</CODE> - the key code of the key that was pressed</DL>
</DD>
</DL>
<HR>
<A NAME="keyRepeated(int)"><!-- --></A><H3>
keyRepeated</H3>
<PRE>
protected void <B>keyRepeated</B>(int keyCode)</PRE>
<DL>
<DD>Called when a key is repeated (held down). <P>The <code>getGameAction()</code> method can be called to determine what game action, if any, is mapped to the key. Class <code>Canvas</code> has an empty implementation of this method, and the subclass has to redefine it if it wants to listen this method. </P><DD><DL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -