1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
/**
*
*/
public class FirstClass extends FullScreen implements KeyListener
{
public FirstClass ()
{
super();
}
public void paint(Graphics graphics)
{
Bitmap img = Bitmap.getBitmapResource("example.png");
graphics.setBackgroundImage(img, this.getWidth(), this.getHeight());
super.paint(graphics);
}
//----- Key Listener Implementation -----
/* Implementation of KeyListener.keyChar(). */
public boolean keyChar(char key, int status, int time)
{
/* Intercept the ESC key and exit the application. */
boolean retval = false;
switch (key)
{
case Characters.BACKSPACE:
Bitmap img = Bitmap.getBitmapResource("example.png");
BitmapField bf = new BitmapField(img, BitmapField.NON_FOCUSABLE);
add(bf);
retval = true;
break;
case Characters.ESCAPE:
//onExit();
System.exit(0);
retval = true;
break;
}
return retval;
}
/* Implementation of KeyListener.keyStatus(). */
public boolean keyStatus(int keycode, int time)
{
return false;
}
/* Implementation of KeyListener.keyRepeat(). */
public boolean keyRepeat(int keycode, int time)
{
return false;
}
/* Implementation of KeyListener.keyUp(). */
public boolean keyUp(int keycode, int time)
{
return false;
}
/* Implementation of KeyListener.keyDown(). */
public boolean keyDown(int keycode, int time)
{
return false;
} |
Partager