📄 rgbdata_midlet.java
字号:
package ch06;
import java.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class rgbData_MIDlet
extends MIDlet
implements CommandListener {
//声明一个实现绘制的Canvas类对象
private rgbData_Canvas cgc;
/*
1.启动应用程序
*/
public void startApp() {
if (cgc == null) {
try {
cgc = new rgbData_Canvas();
Display.getDisplay(this).setCurrent(cgc);
Command exitCommand = new Command("退出", Command.EXIT, 0);
cgc.addCommand(exitCommand);
cgc.setCommandListener(this);
//启动绘制图形
cgc.start();
}
catch (IOException ioe) {
System.out.println(ioe.getMessage());
}
}
}
//挂起应用程序
public void pauseApp() {
}
//撤消应用程序
public void destroyApp(boolean unconditional) {
}
/*
2.响应按钮事件
*/
public void commandAction(Command c, Displayable s) {
if (c.getCommandType() == Command.EXIT) {
destroyApp(true);
notifyDestroyed();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -