| | |
| | | |
| | | public class BrydzForm extends Form implements CommandListener, ItemStateListener { |
| | | protected BrydzMIDlet midlet; |
| | | protected BrydzMenu menu = null; |
| | | |
| | | protected TextField kontraktField; |
| | | protected ChoiceGroup kontraktChoice; |
| | |
| | | this.append(this.lewyField); |
| | | this.append(this.resultText); |
| | | |
| | | setItemStateListener(this); |
| | | setCommandListener(this); |
| | | addCommand(new Command("Wyczyść", Command.OK, 1)); |
| | | addCommand(new Command("Wyjście", Command.EXIT, 1)); |
| | | this.addCommand(new Command("Wyczyść", Command.BACK, 1)); |
| | | this.addCommand(new Command("Menu", Command.OK, 1)); |
| | | |
| | | this.setItemStateListener(this); |
| | | this.setCommandListener(this); |
| | | } |
| | | |
| | | public void commandAction(Command command, Displayable displayable) { |
| | | if (command.getCommandType() == Command.OK) { |
| | | if (command.getCommandType() == Command.BACK) { |
| | | this.kontraktField.setString(null); |
| | | this.kontraktChoice.setSelectedIndex(0, true); |
| | | this.kontraChoice.setSelectedIndex(0, true); |
| | |
| | | this.lewyField.setString(null); |
| | | this.resultText.setText("Podaj wszystkie dane."); |
| | | |
| | | Display.getDisplay(this.midlet).setCurrentItem(this.kontraktField); |
| | | this.midlet.display.setCurrentItem(this.kontraktField); |
| | | } |
| | | else if (command.getCommandType() == Command.EXIT) { |
| | | this.midlet.destroyApp(true); |
| | | else if (command.getCommandType() == Command.OK) { |
| | | if(this.menu == null) { |
| | | this.menu = new BrydzMenu(this.midlet, this); |
| | | } |
| | | this.midlet.display.setCurrent(this.menu); |
| | | } |
| | | } |
| | | |