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 65 66 67 68 69 70 71
| import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.io.IOException;
public class Bing extends MIDlet
{
private Display _display;
private Moteur _moteur;
public Bing()
{
_moteur = new Moteur();
_display = Display.getDisplay(this);
}
protected void destroyApp(boolean unconditional)
{
}
protected void startApp()
{
_display.setCurrent(_moteur);
}
protected void pauseApp(){}
}
class Moteur extends Canvas
{
private int _height,_zoneH;
private int _width,_zoneW;
public Moteur()
{
_height = getHeight();
_width = getWidth();
_zoneW = _width -5 ;
_zoneH = _height -5;
}
protected void paint(Graphics g)
{
Image source;
try
{
source = Image.createImage("eye.png");
}
catch (IOException e)
{
throw new RuntimeException ("Unable to load Image - "+e);
}
Image copy = Image.createImage(source.getWidth(), source.getHeight());
g = copy.getGraphics();
g.drawImage(source, 0, 0, Graphics.TOP|Graphics.LEFT);
}
protected void keyPressed(int keyCode)
{
}
protected void keyReleased(int keyCode)
{
}
} |