📄 rotatingcube.java
字号:
import javax.microedition.midlet.*;import javax.microedition.lcdui.*;import java.util.*;// Our custom MIDlet public class RotatingCube extends MIDlet{ static RotatingCube instance; MyCanvas displayable = new MyCanvas(); // Custom Canvas does 3D graphics Timer iTimer = new Timer(); // Timer to implement animation // MIDlet's constructor public RotatingCube() { this.instance = this; } // end constructor // Main entry point public void startApp() { Display.getDisplay(this).setCurrent(displayable); iTimer.schedule( new MyTimerTask(), 0, 40 ); // Start timer } // end startApp() // Manage pausing the MIDlet public void pauseApp() { } // end pauseApp // Manage terminating the MIDlet public void destroyApp(boolean unconditional) { } // end destroyApp() // Quit the MIDlet, doing any clean-up before calling destroyApp() public static void quitApp() { instance.destroyApp(true); instance.notifyDestroyed(); instance = null; } // end quitApp() // Our timer task for providing animation class MyTimerTask extends TimerTask { public void run() { if( displayable != null ) { // If Canvas is present... displayable.repaint(); // ... call its repaint() } // end if } // end run } // end TimerTask} // end MIDletMain
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -