DoubleBufferDemo.java
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:

J2ME

开发平台:

Java

  1. package doublebufferdemo;
  2. import javax.microedition.lcdui.*;
  3. import javax.microedition.midlet.*;
  4. public class DoubleBufferDemo extends MIDlet implements CommandListener
  5. {
  6.         private Display display;
  7.         private ImageCanvas myCanvas;
  8.         private Command   exitCmd = new Command(" 退出", Command.SCREEN, 1);
  9.         public DoubleBufferDemo()
  10.         {
  11.          myCanvas = new ImageCanvas();
  12.                 display = Display.getDisplay(this);
  13.                 myCanvas.addCommand(exitCmd);                                
  14.                 myCanvas.setCommandListener(this);
  15.         }
  16.         public void startApp()
  17.         {
  18.                 
  19.                  display.setCurrent(myCanvas);
  20.         }
  21.         public void pauseApp()
  22.         {
  23.         }
  24.         public void destroyApp(boolean unconditional)
  25.         {
  26.         }
  27.         public void commandAction(Command cmd, Displayable disp) {
  28.         if(cmd == exitCmd){
  29.         destroyApp(false);
  30.         notifyDestroyed();
  31.         }               
  32.         }
  33. }