📄 alertwithindicatorandthreadmidlet.java
字号:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class AlertWithIndicatorAndThreadMIDlet extends MIDlet
implements CommandListener
{
private Display display;
public AlertWithIndicatorAndThreadMIDlet()
{
display = Display.getDisplay(this);
}
Alert al ;
public void startApp()
{
al = new Alert("处理中");
al.setType(AlertType.INFO);
al.setTimeout(Alert.FOREVER);
al.setString("系统正在处理中");
Gauge g = new Gauge(null,false,10,0) ;
al.setIndicator(g);
Command start = new Command("开始",Command.OK,1) ;
Command stop = new Command("停止",Command.STOP,1);
al.addCommand(start);
al.addCommand(stop);
al.setCommandListener(this);
display.setCurrent(al);
}
public void commandAction(Command c,Displayable s)
{
String cmd = c.getLabel() ;
if(cmd.equals("开始"))
{
AlertWithIndicatorAndThreadMIDletThread t =
new AlertWithIndicatorAndThreadMIDletThread(al) ;
t.start() ;
}else if(cmd.equals("停止"))
{
notifyDestroyed() ;
}
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -