?? choiceexample.java
字號:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class ChoiceExample extends MIDlet implements CommandListener
{
private Form form;
public ChoiceExample()
{
form = new Form("Choice Example");
// a simple example of a popup list containing the names of shapes
ChoiceGroup c = new ChoiceGroup("Shapes", Choice.POPUP);
c.append("Triangle", null);
c.append("Square", null);
c.append("Circle", null);
form.append(c);
// create an exlusive style choice with items representing different
// fonts, then we set that style.
ChoiceGroup c2 = new ChoiceGroup("Styles", Choice.EXCLUSIVE);
c2.append("Italic", null);
c2.append("Bold", null);
c2.setFont(0, Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_ITALIC,
Font.SIZE_SMALL));
c2.setFont(1, Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD,
Font.SIZE_SMALL));
form.append(c2);
// a wide list with wrapping on
ChoiceGroup c3 = new ChoiceGroup("Wrapped Choice", Choice.EXCLUSIVE);
c3.append("A long line of text that is too wide for the display", null);
c3.setFitPolicy(Choice.TEXT_WRAP_ON);
form.append(c3);
// a wide list with wrapping off
ChoiceGroup c4 = new ChoiceGroup("Non-Wrapped Choice", Choice.EXCLUSIVE);
c4.append("A long line of text that is too wide for the display", null);
c4.setFitPolicy(Choice.TEXT_WRAP_OFF);
form.append(c4);
form.addCommand(new Command("Exit", Command.EXIT, 0));
form.setCommandListener(this);
}
public void startApp()
{
Display.getDisplay(this).setCurrent(form);
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
public void commandAction(Command c, Displayable s)
{
if (c.getCommandType() == Command.EXIT)
notifyDestroyed();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -