📄 stringitemdemo.java
字号:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class StringItemDemo extends MIDlet implements CommandListener,ItemCommandListener
{
private Display display;
private Form form;
private StringItem s1,s2,s3;
private Command exit;
private Command button;
private Command link;
public StringItemDemo()
{
display = Display.getDisplay(this);
s1 = new StringItem("1", "普通模式",StringItem.PLAIN);
s2 = new StringItem("2", "按钮模式",StringItem.BUTTON);
s3 = new StringItem("3", "超链接模式",StringItem.HYPERLINK);
exit = new Command("Exit", Command.EXIT, 1);
button= new Command("Button",Command.ITEM,2);
link= new Command("link",Command.ITEM,3);
s2.setDefaultCommand(button);
s3.setDefaultCommand(link);
s2.setItemCommandListener(this);
s3.setItemCommandListener(this);
form = new Form("各种StringItem外观");
form.addCommand(exit);
form.append(s1);
form.append(s2);
form.append(s3);
form.setCommandListener(this);
}
public void startApp()
{
display.setCurrent(form);
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
public void commandAction(Command command, Displayable displayable)
{
if (command == exit)
{
destroyApp(false);
notifyDestroyed();
}
}
public void commandAction(Command command,Item item)
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -