📄 check_color.java
字号:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class Check_Color extends MIDlet implements CommandListener{
private Display display;
private TextBox tb;
Command cmd_Exit;
Command cmd_Color;
public Check_Color(){
display=Display.getDisplay(this);
tb = new TextBox("Check Colors of the Device","Check Color",50,0);
cmd_Exit = new Command("Exit",Command.EXIT,1);
cmd_Color= new Command("check",Command.SCREEN,1);
tb.addCommand(cmd_Exit);
tb.addCommand(cmd_Color);
tb.setCommandListener(this);
}
public void startApp(){
display.setCurrent(tb);
}
public void pauseApp(){
}
public void destroyApp(boolean unconditional){
}
public void commandAction(Command c,Displayable d){
if(c==cmd_Exit){
destroyApp(false);
notifyDestroyed();
}
if(c==cmd_Color){
if(display.isColor()){
tb.setString("the device is "+display.numColors()+" colors");
display.setCurrent(tb);
}
else{
tb.setString("the device is "+display.numColors()+" graylevels");
display.setCurrent(tb);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -