📄 canvas.html
字号:
<code>hideNotify()</code>. After <code>hideNotify()</code> has been called, none of the key, pointer, and <code>paint</code> methods will be called until after a subsequent call to <code>showNotify()</code> has returned. A call to a <code>run()</code> method resulting from <code>callSerially()</code> may occur irrespective of calls to <code>showNotify()</code> and <code>hideNotify()</code>. </p> <p> The <A HREF="../../../javax/microedition/lcdui/Canvas.html#showNotify()"><CODE>showNotify()</CODE></A> method is called prior to the <code>Canvas</code> actually being made visible on the display, and the <A HREF="../../../javax/microedition/lcdui/Canvas.html#hideNotify()"><CODE>hideNotify()</CODE></A> method is called after the <code>Canvas</code> has been removed from the display. The visibility state of a <code>Canvas</code> (or any other <code>Displayable</code> object) may be queried through the use of the <A HREF="../../../javax/microedition/lcdui/Displayable.html#isShown()"><CODE>Displayable.isShown()</CODE></A> method. The change in visibility state of a <code>Canvas</code> may be caused by the application management software moving <code>MIDlets</code> between foreground and background states, or by the system obscuring the <code>Canvas</code> with system screens. Thus, the calls to <code>showNotify()</code> and <code>hideNotify()</code> are not under the control of the <code>MIDlet</code> and may occur fairly frequently. Application developers are encouraged to perform expensive setup and teardown tasks outside the <code>showNotify()</code> and <code>hideNotify()</code> methods in order to make them as lightweight as possible. </p> <a name="fullscreen"></a> <P>A <code>Canvas</code> can be in normal mode or in full-screen mode. In normal mode, space on the display may be occupied by command labels, a title, and a ticker. By setting a <code>Canvas</code> into full-screen mode, the application is requesting that the <code>Canvas</code> occupy as much of the display space as is possible. In full-screen mode, the title and ticker are not displayed even if they are present on the <code>Canvas</code>, and <code>Commands</code> may be presented using some alternative means (such as through a pop-up menu). Note that the implementation may still consume a portion of the display for things like status indicators, even if the displayed <code>Canvas</code> is in full-screen mode. In full-screen mode, although the title is not displayed, its text may still be used for other purposes, such as for the title of a pop-up menu of <code>Commands</code>.</P> <P><code>Canvas</code> objects are in normal mode by default. The normal vs. full-screen mode setting is controlled through the use of the <A HREF="../../../javax/microedition/lcdui/Canvas.html#setFullScreenMode(boolean)"><CODE>setFullScreenMode(boolean)</CODE></A> method.</P> <P>Calling <A HREF="../../../javax/microedition/lcdui/Canvas.html#setFullScreenMode(boolean)"><CODE>setFullScreenMode(boolean)</CODE></A> may result in <A HREF="../../../javax/microedition/lcdui/Canvas.html#sizeChanged(int, int)"><CODE>sizeChanged()</CODE></A> being called. The default implementation of this method does nothing. The application can override this method to handle changes in size of available drawing area. </p> <P><strong>Note:</strong> As mentioned in the "Specification Requirements" section of the overview, implementations must provide the user with an indication of network usage. If the indicator is rendered on screen, it must be visible when network activity occurs, even when the <code>Canvas</code> is in full-screen mode.</P>
<P>
<DL>
<DT><B>Since: </B><DD>MIDP 1.0</DD>
</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 int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#DOWN">DOWN</A></B></CODE>
<BR>
Constant for the <code>DOWN</code> game action.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#FIRE">FIRE</A></B></CODE>
<BR>
Constant for the <code>FIRE</code> game action.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#GAME_A">GAME_A</A></B></CODE>
<BR>
Constant for the general purpose "<code>A</code>" game action.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#GAME_B">GAME_B</A></B></CODE>
<BR>
Constant for the general purpose "<code>B</code>" game action.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#GAME_C">GAME_C</A></B></CODE>
<BR>
Constant for the general purpose "<code>C</code>" game action.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#GAME_D">GAME_D</A></B></CODE>
<BR>
Constant for the general purpose "<code>D</code>" game action.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#KEY_NUM0">KEY_NUM0</A></B></CODE>
<BR>
keyCode for ITU-T key <code>0</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#KEY_NUM1">KEY_NUM1</A></B></CODE>
<BR>
keyCode for ITU-T key <code>1</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#KEY_NUM2">KEY_NUM2</A></B></CODE>
<BR>
keyCode for ITU-T key <code>2</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#KEY_NUM3">KEY_NUM3</A></B></CODE>
<BR>
keyCode for ITU-T key <code>3</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#KEY_NUM4">KEY_NUM4</A></B></CODE>
<BR>
keyCode for ITU-T key <code>4</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#KEY_NUM5">KEY_NUM5</A></B></CODE>
<BR>
keyCode for ITU-T key <code>5</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#KEY_NUM6">KEY_NUM6</A></B></CODE>
<BR>
keyCode for ITU-T key <code>6</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#KEY_NUM7">KEY_NUM7</A></B></CODE>
<BR>
keyCode for ITU-T key <code>7</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#KEY_NUM8">KEY_NUM8</A></B></CODE>
<BR>
keyCode for ITU-T key <code>8</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#KEY_NUM9">KEY_NUM9</A></B></CODE>
<BR>
keyCode for ITU-T key <code>9</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#KEY_POUND">KEY_POUND</A></B></CODE>
<BR>
keyCode for ITU-T key "pound" (<code>#</code>).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#KEY_STAR">KEY_STAR</A></B></CODE>
<BR>
keyCode for ITU-T key "star" (<code>*</code>).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#LEFT">LEFT</A></B></CODE>
<BR>
Constant for the <code>LEFT</code> game action.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#RIGHT">RIGHT</A></B></CODE>
<BR>
Constant for the <code>RIGHT</code> game action.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#UP">UP</A></B></CODE>
<BR>
Constant for the <code>UP</code> game action.</TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected </CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#Canvas()">Canvas</A></B>()</CODE>
<BR>
Constructs a new <code>Canvas</code> object.</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#getGameAction(int)">getGameAction</A></B>(int keyCode)</CODE>
<BR>
Gets the game action associated with the given key code of the device.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/lcdui/Canvas.html#getKeyCode(int)">getKeyCode</A></B>(int gameAction)</CODE>
<BR>
Gets a key code that corresponds to the specified game action on the device.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../java/lang/String.html">String</A></CODE></FONT></TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -