My First J2ME

源文件1:

import javax.microedition.lcdui.Display;

import javax.microedition.midlet.MIDlet;

public class myMIDlet extends MIDlet

{  

static myMIDlet instance;

  myCanvas displayable = new myCanvas();

  public myMIDlet()

  {

                instance = this;  

 }

 public void startApp()  

{  

                Display.getDisplay(this).setCurrent(displayable);  

}  

public void pauseApp()

   {  

   }

 public void destroyApp(boolean unconditional)  

  {  

   }

 public static void quitApp()

 {  

               instance.destroyApp(true);

               instance.notifyDestroyed();

              instance = null;

  }

}

 

 

源文件2:

import javax.microedition.lcdui.Canvas;

import javax.microedition.lcdui.Graphics;

public class myCanvas extends Canvas

{  

public void paint(Graphics g)

 {   

              g.setClip(0, 0, 240, 320);  

              g.setColor(0xff0000);  

              g.drawRect(0, 0, 100, 200);

              g.fillRect(0, 0, 100, 200);  

             g.drawLine(200, 0, 100, 300);  }

}

 

My First J2ME

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(first)