📄 dialog.java
字号:
import javax.microedition.lcdui.*;
public class Dialog implements CommandListener{
static int LEFT = 1;
static int RIGHT = 2;
Form genDialog;
Command leftCmd;
Command rightCmd;
DialogListener listener;
public Dialog(String title, String leftText, String rightText){
leftCmd = new Command(leftText, Command.SCREEN, 1);
rightCmd = new Command(rightText, Command.SCREEN, 2);
genDialog = new Form(title);
genDialog.addCommand(leftCmd);
genDialog.addCommand(rightCmd);
genDialog.setCommandListener(this);
}
public void setDialogListener(DialogListener dlistener){
listener = dlistener;
}
public void commandAction(Command c, Displayable d){
if(c == leftCmd){
listener.process(Dialog.LEFT);
}
else if(c == rightCmd){
listener.process(Dialog.RIGHT);
}
}
public void showDialog(Display d){
d.setCurrent(genDialog);
}
public void setText(String text){
genDialog.append(text);
}
public void setImage(Image image){
genDialog.append(image);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -