📄 displayable1.java
字号:
package jb_midlet_1;
import javax.microedition.lcdui.*;
public class Displayable1 extends Form implements CommandListener { StringItem stringItem1; TextField textField1; Gauge gauge1; DateField dateField1; Ticker ticker1;
/**Construct the displayable*/
public Displayable1() {
super("My First MIDlet");
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
/**Component initialization*/
private void jbInit() throws Exception { stringItem1 = new StringItem("", ""); textField1 = new TextField("", "", 15,TextField.ANY); gauge1 = new Gauge("", true, 10, 0); dateField1 = new DateField("",DateField.DATE_TIME); ticker1 = new Ticker(""); ticker1.setString("This is Ticker"); dateField1.setLabel("DateField"); gauge1.setMaxValue(15); gauge1.setValue(8); textField1.setMaxSize(50); textField1.setString("This is a TextField"); stringItem1.setText("This is a StringItem"); this.setTicker(ticker1); this.setTitle("Form");
// set up this Displayable to listen to command events
setCommandListener(this);
// add the Exit command
addCommand(new Command("Exit", Command.EXIT, 1)); this.append(stringItem1); this.append(textField1); this.append(gauge1); this.append(dateField1);
}
/**Handle command events*/
public void commandAction(Command command, Displayable displayable) {
/** @todo Add command handling code */
if (command.getCommandType() == Command.EXIT) {
// stop the MIDlet
MIDlet1.quitApp();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -