📄 worldtest.java
字号:
import net.jscience.math.kvm.MathFP;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.io.IOException;
public class WorldTest extends MIDlet implements CommandListener, Runnable
{
private GameScreen gameScreen;
private Command quit;
private boolean running;
public WorldTest()
{
// Construct a canvas
gameScreen = new GameScreen();
// And a way to quit
quit = new Command("Quit", Command.EXIT, 2);
gameScreen.addCommand(quit);
gameScreen.setCommandListener(this);
running = true;
Thread t = new Thread(this);
t.start();
}
public void run()
{
while (running)
{
gameScreen.repaint();
gameScreen.cycle();
try
{
Thread.sleep(100);
}
catch (InterruptedException e)
{
}
}
}
protected void startApp() throws MIDletStateChangeException
{
Display.getDisplay(this).setCurrent(gameScreen);
}
protected void pauseApp()
{
}
protected void destroyApp(boolean unconditional)
throws MIDletStateChangeException
{
}
public void commandAction(Command command, Displayable displayable)
{
try
{
if (command == quit)
{
running = false;
destroyApp(true);
notifyDestroyed();
}
}
catch (MIDletStateChangeException me)
{
System.out.println(me + " caught.");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -