From 222772648d93da4391b6422da002f921956b345d Mon Sep 17 00:00:00 2001 From: Maik Merten Date: Tue, 22 Jul 2014 17:50:06 +0200 Subject: [PATCH] simple dialog for choosing machine model when no command-line option was given --- .../java/com/loomcom/symon/Simulator.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/loomcom/symon/Simulator.java b/src/main/java/com/loomcom/symon/Simulator.java index 8fb6aa7..05ee417 100644 --- a/src/main/java/com/loomcom/symon/Simulator.java +++ b/src/main/java/com/loomcom/symon/Simulator.java @@ -386,17 +386,37 @@ public class Simulator { */ public static void main(String args[]) { - Class machineClass = SymonMachine.class; + Class machineClass = null; for(int i = 0; i < args.length; ++i) { String arg = args[i].toLowerCase(Locale.ENGLISH); if(arg.equals("-machine") && (i+1) < args.length) { String machine = args[i+1].trim().toLowerCase(Locale.ENGLISH); - if(machine.equals("multicomp")) { + if(machine.equals("symon")) { + machineClass = SymonMachine.class; + } else if(machine.equals("multicomp")) { machineClass = MulticompMachine.class; } } } + if(machineClass == null) { + Object[] possibilities = {"Symon", "Multicomp"}; + String s = (String)JOptionPane.showInputDialog( + null, + "Please choose the machine type to be emulated:", + "Machine selection", + JOptionPane.PLAIN_MESSAGE, + null, + possibilities, + "Symon"); + if(s.equals("Symon")) { + machineClass = SymonMachine.class; + } else { + machineClass = MulticompMachine.class; + } + } + + final Class mClass = machineClass; SwingUtilities.invokeLater(new Runnable() { public void run() {