📄 spacerexample.java
字号:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class SpacerExample extends MIDlet implements CommandListener
{
private Form form;
public SpacerExample()
{
form = new Form("Spacer Example");
// ROW 1 -----------------
SmileyItem s1 = new SmileyItem("Smile 1");
s1.setLayout(Item.LAYOUT_EXPAND | Item.LAYOUT_2);
form.append(s1);
// add a spacer in between the two smileys on the first row
form.append(new Spacer(30, 30));
// add the second smiley
form.append(new SmileyItem("Smile 2"));
// ROW 2 -------------------
form.append(new SmileyItem("Smile 3"));
// add a spacer in between the two smileys on the second row
form.append(new Spacer(30, 30));
SmileyItem s4 = new SmileyItem("Smile 4");
// expand the second smiley (expanding)
s4.setLayout(Item.LAYOUT_EXPAND | Item.LAYOUT_2);
form.append(s4);
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 + -