📄 firmidlet.java
字号:
import java.io.IOException;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
public class FIRMIDlet extends MIDlet implements CommandListener
{
private Display display;
private Form form;
private Image imgSplash;
private Command CMD_EXIT;
private Command CMD_GO;
private Command CMD_OPTION;
private Command CMD_ABOUT;
private FIRCanvas myCanvas;
private Options options;
private About about;
public FIRMIDlet()
{
display = Display.getDisplay(this);
form = new Form(null);
try
{
imgSplash = Image.createImage("/splash.png");
}
catch(IOException _ex)
{
imgSplash = Image.createImage(1, 1);
}
form.append(imgSplash);
CMD_EXIT = new Command("退出", 7, 1);
CMD_GO = new Command("开局", 4, 2);
CMD_OPTION = new Command("设置", 1, 3);
CMD_ABOUT = new Command("关于", 5, 3);
form.addCommand(CMD_GO);
form.addCommand(CMD_OPTION);
form.addCommand(CMD_ABOUT);
form.addCommand(CMD_EXIT);
form.setCommandListener(this);
myCanvas = new FIRCanvas(this);
options = new Options(this);
about = new About(this);
}
public void startApp()
{
display.setCurrent(form);
}
public void pauseApp()
{
}
public void destroyApp(boolean arg0)
{
}
public void commandAction(Command c, Displayable s)
{
if(c == CMD_EXIT)
{
destroyApp(false);
notifyDestroyed();
} else
if(c == CMD_GO)
{
display.setCurrent(myCanvas);
myCanvas.setOptions(options.getBoardSize(), options.isComputerFirst(), options.getDegree());
myCanvas.newStage();
} else
if(c == CMD_OPTION)
display.setCurrent(options.getForm());
else
if(c == CMD_ABOUT)
display.setCurrent(about.getForm());
}
public void comeBack()
{
display.setCurrent(form);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -