import javax.microedition.lcdui.*; public class start extends Canvas { int x,y,mode,h=getHeight(),w=getWidth(); /** * constructor */ public start() { super(); x=5; y=2; mode=0; } /** * paint */ public void paint(Graphics g) { g.setColor(50,50,50); g.fillRect(0,0,w,h); g.setColor(0,200,20); g.fillRect(x,y,w,14); g.fillRect(x,y+18,w,14); g.setColor(255,255,255); if(mode==1) g.drawRect(x,y+18,w+5,14); else g.drawRect(x,y,w+5,14); g.drawString("START",x+2,y+2,0); g.drawString("EXIT",x+2,y+18,0); } /** * Called when a key is pressed. */ protected void keyPressed(int keyCode) { if(keyCode==KEY_NUM2){ mode--; if(mode<0) mode=1; repaint(); } //KEY UP if(keyCode==KEY_NUM8){ mode++; if(mode>1) mode=0; repaint(); } //KEY DOWN if(keyCode==KEY_NUM5){ if(mode==1){ notifyDestroyed(); } if(mode==0){ System.gc(); game ga=new game(); main.link.dis.setCurrent(ga); } } } }