/** @see CommandListener#commandAction(Command, Displayable) */ public void commandAction(Command cmd, Displayable disp) { if (cmd.getCommandType() == Command.EXIT) { sim.destroyApp(false); sim.notifyDestroyed(); } else { Display d = Sim.getDisplay(); switch (getSelectedIndex()) { case 0: // Neues Spiel gamemode = new GameModeForm(); d.setCurrent(gamemode); break; case 1: // Einstellungen d.setCurrent(new PrefForm()); break; case 2: // Info Info.showInfo(d); break; case 3: // About Alert alert2 = new Alert( "About", "SimME\n by SPIESSEIN\n based on HEXI\n by Prof. Slany\n", null, AlertType.INFO); alert2.setTimeout(Alert.FOREVER); d.setCurrent(alert2, this); break; } } }
public static void main(String[] args) { Machine mach1 = new Machine(); mach1.start(); Person person1 = new Person("Bob"); person1.greet(); Info info1 = new Machine(); info1.showInfo(); Info info2 = person1; info2.showInfo(); outputInfo(mach1); outputInfo(person1); }
private static void outputInfo(Info info) { info.showInfo(); }