⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 examplemidlet.java

📁 Game_Anim_Java_MIDP_v1_0.zip详细的介绍了midp1.0中动画的制作
💻 JAVA
字号:
package example;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2003</p> * <p>Company: Sensible Development Ltd</p> * @author Alan Newman * @version 1.0 */import javax.microedition.lcdui.*;import javax.microedition.midlet.*;public class ExampleMidlet extends MIDlet{  private MyCanvas canvas;  public ExampleMidlet()  {  }  protected void startApp(  ) throws MIDletStateChangeException  {    initMidlet();    Display.getDisplay(this).setCurrent(canvas);    canvas.start();    System.out.println("Midlet initialised");  }  protected void pauseApp(  )  {    canvas.stop();  }  protected void destroyApp( boolean p1 )  {    canvas.stop();  }  private void initMidlet()  {    // initialise the canvas    System.out.println("Free memory: "+Runtime.getRuntime().freeMemory());    canvas=new MyCanvas(this);    System.out.println("Canvas created.");    System.out.println("Free memory: "+Runtime.getRuntime().freeMemory());  }  public void exitMidlet()  {    destroyApp(false);    notifyDestroyed();  }  protected static Image[] getImages(String imgName, int frames)  {    Image[] images = new Image[frames];    try    {      for (int i=0;i<frames;++i)      {        images[i] = Image.createImage("/"+imgName+"_"+i+".png");      }    }    catch(java.io.IOException e)    {      System.out.println("Image, "+imgName+", could not be loaded.");    }    return images;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -