📄 gamecanvas.html
字号:
<!-- ======== 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/game/GameCanvas.html#GameCanvas(boolean)">GameCanvas</A></B>(boolean suppressKeyEvents)</CODE>
<BR>
Creates a new instance of a GameCanvas.</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> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#flushGraphics()">flushGraphics</A></B>()</CODE>
<BR>
Flushes the off-screen buffer to the display.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#flushGraphics(int, int, int, int)">flushGraphics</A></B>(int x, int y, int width, int height)</CODE>
<BR>
Flushes the specified region of the off-screen buffer to the display.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../../../javax/microedition/lcdui/Graphics.html">Graphics</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#getGraphics()">getGraphics</A></B>()</CODE>
<BR>
Obtains the Graphics object for rendering a GameCanvas.</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/game/GameCanvas.html#getKeyStates()">getKeyStates</A></B>()</CODE>
<BR>
Gets the states of the physical game keys.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/microedition/lcdui/game/GameCanvas.html#paint(javax.microedition.lcdui.Graphics)">paint</A></B>(<A HREF="../../../../javax/microedition/lcdui/Graphics.html">Graphics</A> g)</CODE>
<BR>
Paints this GameCanvas.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_javax.microedition.lcdui.Canvas"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class javax.microedition.lcdui.<A HREF="../../../../javax/microedition/lcdui/Canvas.html">Canvas</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../javax/microedition/lcdui/Canvas.html#getGameAction(int)">getGameAction</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#getKeyCode(int)">getKeyCode</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#getKeyName(int)">getKeyName</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#hasPointerEvents()">hasPointerEvents</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#hasPointerMotionEvents()">hasPointerMotionEvents</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#hasRepeatEvents()">hasRepeatEvents</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#hideNotify()">hideNotify</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#isDoubleBuffered()">isDoubleBuffered</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#keyPressed(int)">keyPressed</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#keyReleased(int)">keyReleased</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#keyRepeated(int)">keyRepeated</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#pointerDragged(int, int)">pointerDragged</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#pointerPressed(int, int)">pointerPressed</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#pointerReleased(int, int)">pointerReleased</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#repaint()">repaint</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#repaint(int, int, int, int)">repaint</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#serviceRepaints()">serviceRepaints</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#setFullScreenMode(boolean)">setFullScreenMode</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#showNotify()">showNotify</A>, <A HREF="../../../../javax/microedition/lcdui/Canvas.html#sizeChanged(int, int)">sizeChanged</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_javax.microedition.lcdui.Displayable"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class javax.microedition.lcdui.<A HREF="../../../../javax/microedition/lcdui/Displayable.html">Displayable</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../javax/microedition/lcdui/Displayable.html#addCommand(javax.microedition.lcdui.Command)">addCommand</A>, <A HREF="../../../../javax/microedition/lcdui/Displayable.html#getHeight()">getHeight</A>, <A HREF="../../../../javax/microedition/lcdui/Displayable.html#getTicker()">getTicker</A>, <A HREF="../../../../javax/microedition/lcdui/Displayable.html#getTitle()">getTitle</A>, <A HREF="../../../../javax/microedition/lcdui/Displayable.html#getWidth()">getWidth</A>, <A HREF="../../../../javax/microedition/lcdui/Displayable.html#isShown()">isShown</A>, <A HREF="../../../../javax/microedition/lcdui/Displayable.html#removeCommand(javax.microedition.lcdui.Command)">removeCommand</A>, <A HREF="../../../../javax/microedition/lcdui/Displayable.html#setCommandListener(javax.microedition.lcdui.CommandListener)">setCommandListener</A>, <A HREF="../../../../javax/microedition/lcdui/Displayable.html#setTicker(javax.microedition.lcdui.Ticker)">setTicker</A>, <A HREF="../../../../javax/microedition/lcdui/Displayable.html#setTitle(java.lang.String)">setTitle</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.<A HREF="../../../../java/lang/Object.html">Object</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="UP_PRESSED"><!-- --></A><H3>
UP_PRESSED</H3>
<PRE>
public static final int <B>UP_PRESSED</B></PRE>
<DL>
<DD>The bit representing the UP key. This constant has a value of <code>0x0002</code> (1 << Canvas.UP).</DL>
<HR>
<A NAME="DOWN_PRESSED"><!-- --></A><H3>
DOWN_PRESSED</H3>
<PRE>
public static final int <B>DOWN_PRESSED</B></PRE>
<DL>
<DD>The bit representing the DOWN key. This constant has a value of <code>0x0040</code> (1 << Canvas.DOWN).</DL>
<HR>
<A NAME="LEFT_PRESSED"><!-- --></A><H3>
LEFT_PRESSED</H3>
<PRE>
public static final int <B>LEFT_PRESSED</B></PRE>
<DL>
<DD>The bit representing the LEFT key. This constant has a value of <code>0x0004</code> (1 << Canvas.LEFT).</DL>
<HR>
<A NAME="RIGHT_PRESSED"><!-- --></A><H3>
RIGHT_PRESSED</H3>
<PRE>
public static final int <B>RIGHT_PRESSED</B></PRE>
<DL>
<DD>The bit representing the RIGHT key. This constant has a value of <code>0x0020</code> (1 << Canvas.RIGHT).</DL>
<HR>
<A NAME="FIRE_PRESSED"><!-- --></A><H3>
FIRE_PRESSED</H3>
<PRE>
public static final int <B>FIRE_PRESSED</B></PRE>
<DL>
<DD>The bit representing the FIRE key. This constant has a value of <code>0x0100</code> (1 << Canvas.FIRE).</DL>
<HR>
<A NAME="GAME_A_PRESSED"><!-- --></A><H3>
GAME_A_PRESSED</H3>
<PRE>
public static final int <B>GAME_A_PRESSED</B></PRE>
<DL>
<DD>The bit representing the GAME_A key (may not be supported on all devices). This constant has a value of <code>0x0200</code> (1 << Canvas.GAME_A).</DL>
<HR>
<A NAME="GAME_B_PRESSED"><!-- --></A><H3>
GAME_B_PRESSED</H3>
<PRE>
public static final int <B>GAME_B_PRESSED</B></PRE>
<DL>
<DD>The bit representing the GAME_B key (may not be supported on all devices). This constant has a value of <code>0x0400</code> (1 << Canvas.GAME_B).</DL>
<HR>
<A NAME="GAME_C_PRESSED"><!-- --></A><H3>
GAME_C_PRESSED</H3>
<PRE>
public static final int <B>GAME_C_PRESSED</B></PRE>
<DL>
<DD>The bit representing the GAME_C key (may not be supported on all devices). This constant has a value of <code>0x0800</code> (1 << Canvas.GAME_C).</DL>
<HR>
<A NAME="GAME_D_PRESSED"><!-- --></A><H3>
GAME_D_PRESSED</H3>
<PRE>
public static final int <B>GAME_D_PRESSED</B></PRE>
<DL>
<DD>The bit representing the GAME_D key (may not be supported on all devices). This constant has a value of <code>0x1000</code> (1 << Canvas.GAME_D).</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="GameCanvas(boolean)"><!-- --></A><H3>
GameCanvas</H3>
<PRE>
protected <B>GameCanvas</B>(boolean suppressKeyEvents)</PRE>
<DL>
<DD>Creates a new instance of a GameCanvas. A new buffer is also created for the GameCanvas and is initially filled with white pixels. <p> If the developer only needs to query key status using the getKeyStates method, the regular key event mechanism can be suppressed for game keys while this GameCanvas is shown. If not needed by the application, the suppression of key events may improve performance by eliminating unnecessary system calls to keyPressed, keyRepeated and keyReleased methods. <p> If requested, key event suppression for a given GameCanvas is started when it is shown (i.e. when showNotify is called) and stopped when it is hidden (i.e. when hideNotify is called). Since the showing and hiding of screens is serialized with the event queue, this arrangement ensures that the suppression effects only those key events intended for the corresponding GameCanvas. Thus, if key events are being generated while another screen is still shown, those key events will continue to be queued and dispatched until that screen is hidden and the GameCanvas has replaced it. <p> Note that key events can be suppressed only for the defined game keys
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -