From bf2df04c8c12760206ea1d5be5c7e008123cc695 Mon Sep 17 00:00:00 2001 From: Jacek Kowalski <Jacek@jacekk.info> Date: Tue, 07 Aug 2012 12:20:57 +0000 Subject: [PATCH] 1. Dodanie menu z pomocą oraz informacją o autorze. 2. Dodanie pola display do głównej klasy midletu. 3. Drobne zmiany w kolejności linii. --- src/brydz/BrydzForm.java | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/brydz/BrydzForm.java b/src/brydz/BrydzForm.java index 9c8f78d..33adaa1 100644 --- a/src/brydz/BrydzForm.java +++ b/src/brydz/BrydzForm.java @@ -4,6 +4,7 @@ public class BrydzForm extends Form implements CommandListener, ItemStateListener { protected BrydzMIDlet midlet; + protected BrydzMenu menu = null; protected TextField kontraktField; protected ChoiceGroup kontraktChoice; @@ -51,14 +52,15 @@ 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); @@ -67,10 +69,13 @@ 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); } } -- Gitblit v1.9.1