j2me - graphic [小糊涂的灵感]
graphic canvas
---image items
transparent.
dubble -buffer
shownotify ?
the
getGameAction() method so that, for example, the expression (getGameAction(keyCode)
== Canvas.LEFT) can be used to check whether the key that corresponds to LEFT has
been pressed (or released).
int width = getWidth( );
int height = getHeight( );
// Fill the background using black
g.setColor(0);
g.fillRect(0, 0, width, height);
// Load an image from the MIDlet resources
if (image == null) {
try {
image = Image.createImage("/ora/ch5/resources/earth.png");
} catch (IOException ex) {
g.setColor(0xffffff);
g.drawString("Failed to load image!", 0, 0, Graphics.TOP |
Graphics.LEFT);
return;
}
}
setcommandlistener
imageitem 是特定的?
canvas -< keypressed
Never giveup. Thanks the world.