Obliczenia brydżowe (Java ME)
Jacek Kowalski
2012-08-07 bf2df04c8c12760206ea1d5be5c7e008123cc695
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);
        }
    }