hello3d.java

来自「3D手机游戏开发实例源代码」· Java 代码 · 共 29 行

JAVA
29
字号
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
import javax.microedition.m3g.Graphics3D;
public class Hello3D extends MIDlet implements CommandListener
{
  private Command exitCommand = new Command("Exit", Command.EXIT, 1);
  public void startApp()
  {
    Form mForm = new Form("Hello 3D Properties:");
    String s = new String();
    Font.getFont(0, 1, 8);
    mForm.append("\nM3G Version: ");
    mForm.append(s + System.getProperty("microedition.m3g.version"));//获取M3G版本属性
    mForm.addCommand(exitCommand);				//添加退出按钮
    mForm.setCommandListener(this);					//设置软键监听
    Display.getDisplay(this).setCurrent(mForm);			//显示Form
  }
  public void pauseApp()  {  }
  public void destroyApp(boolean unconditional)  {  }
  public void commandAction(Command command, Displayable displayable)
  {
    if (command == exitCommand)					//当按下Exit软键则退出程序
    {
      destroyApp(true);
      notifyDestroyed();
    }
  }
}

⌨️ 快捷键说明

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