📄 gaugedemo.java
字号:
//gaugeDemo.java file
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class gaugeDemo extends MIDlet implements CommandListener
{
private Command exitCommand;
private Form form;
public gaugeDemo()
{
exitCommand =new Command("Exit",Command.EXIT,1);
form = new Form("gauge form");
form.addCommand(exitCommand);
//设置命令监听对象
form.setCommandListener(this);
form.append(new Gauge("Interactive",true,10 ,0 ));
form.append(new Gauge("nonInteractive",false,100 ,0));
((Gauge)form.get(1)).setValue(30);
//如果为MIDP v2.0 则可以调整布局方式
form.get(0).setLayout(Item.LAYOUT_EXPAND| Item.LAYOUT_2|Item.LAYOUT_NEWLINE_AFTER);
form.get(1).setLayout(Item.LAYOUT_EXPAND| Item.LAYOUT_2|Item.LAYOUT_NEWLINE_AFTER);
}
protected void startApp( ) throws MIDletStateChangeException
{
Display.getDisplay(this).setCurrent(form);
}
protected void pauseApp( )
{
}
protected void destroyApp( boolean p1 )
{
}
public void commandAction(Command c,Displayable d)
{
if (c ==exitCommand)
{
destroyApp(false);
notifyDestroyed();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -