日期:2014-05-20 浏览次数:20757 次
import javax.microedition.midlet.MIDlet; import javax.microedition.midlet.MIDletStateChangeException; import javax.microedition.lcdui.*; import com.nokia.mid.ui.DeviceControl; public class a extends MIDlet { private Display display; MyCanvas mc = new MyCanvas(); public a() { } protected void startApp() throws MIDletStateChangeException { display = Display.getDisplay(this); display.setCurrent(mc); } protected void destroyApp(boolean arg0) throws MIDletStateChangeException { } protected void pauseApp() { } class MyCanvas extends Canvas { public void paint(Graphics g) { g.setColor(255, 255, 255); g.fillRect(0, 0, 320, 240); setFullScreenMode(true); DeviceControl.setLights(0, 100); } protected void keyPressed(int keyCode) { if (keyCode == 165 || keyCode == 51 || keyCode == -7) { try { destroyApp(true); } catch (MIDletStateChangeException e) { e.printStackTrace(); } notifyDestroyed(); } } } }