📄 alertwithtextboxmidlet.java
字号:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class AlertWithTextBoxMIDlet extends MIDlet implements CommandListener
{
private Display display;
public AlertWithTextBoxMIDlet()
{
display = Display.getDisplay(this);
}
public void startApp()
{
TextBox tb = new TextBox("text box","欢迎加入数字传媒系游戏二班 MIDP GUI 编程世界!", 40, TextField.ANY);
Alert timedAlert = new Alert("Login","游戏二班J2ME课堂", null, AlertType.CONFIRMATION);
timedAlert.setTimeout(5000);
tb.addCommand(new Command("退出",Command.OK,1));
tb.setCommandListener(this);
display.setCurrent(timedAlert, tb);
}
public void commandAction(Command c, Displayable s)
{
if(c.getLabel().equals("退出"))
{
destroyApp(true); notifyDestroyed();
}
}
public void pauseApp() { }
public void destroyApp(boolean unconditional) { }
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -