ВУЗ:
Составители:
Рубрика:
102
// Process the global commands
public void commandAction(Command command, Displayable
d) {
if (command == exitCommand) {
notifyDestroyed();
}
else if (command == nextCommand) {
dispaly.setCurrent(forms[nextFormIndex()]);
}
}
private int nextFormIndex() {
if (currentForm == forms.length) {
currentForm = 0;
}
return currentForm++;
}
private void makeForms() {
// Create the first form
Form form1 = new Form("Form1. Layout of StringI-
tems");
item1 = new StringItem(null, "one", Item.BUTTON);
item2 = new StringItem(null, "two");
item3 = new StringItem(null, "three",
Item.HYPERLINK);
// Define command and command listener for item1
Command changeLayoutCommand = new Command("one",
Command.ITEM, 0);
item1.setDefaultCommand(changeLayoutCommand);
item1.setItemCommandListener(new ItemCommandListen-
er() {
public void commandAction(Command c, Item item)
{
// Change the layout mode for all StringItems
item1.setLayout(Item.LAYOUT_2 |
Item.LAYOUT_LEFT | Item.LAYOUT_NEWLINE_AFTER);
item2.setLayout(Item.LAYOUT_2 |
Item.LAYOUT_CENTER | Item.LAYOUT_NEWLINE_AFTER);
item3.setLayout(Item.LAYOUT_2 |
Item.LAYOUT_RIGHT | Item.LAYOUT_NEWLINE_AFTER);
}
});
form1.append(item1);
form1.append(item2);
form1.append(item3);
// Create the second form
Form form2 = new Form("Form2. DateField");
// Create the DateField item and place it on the form2
Страницы
- « первая
- ‹ предыдущая
- …
- 100
- 101
- 102
- 103
- 104
- …
- следующая ›
- последняя »