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