⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gaugedemo.java

📁 javaME useful code with the J2ME helpful learning cla
💻 JAVA
字号:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class GaugeDemo extends MIDlet
implements CommandListener
{
private Display display;
public GaugeDemo()
{
display = Display.getDisplay(this);
}
Gauge g ;
public void startApp()
{
Alert al = new Alert("处理中");
al.setType(AlertType.INFO);
al.setTimeout(Alert.FOREVER);
al.setString("系统正在处理中");
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("开始"))
{
for(int i=0 ; i <11 ; i++)
{
g.setValue(i);
try
{
Thread.sleep(500);
}catch(Exception e){}
}
}else if(cmd.equals("停止"))
{
notifyDestroyed() ;
}
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -