1
0
mirror of https://github.com/sethm/symon.git synced 2025-01-19 15:30:14 +00:00

simple dialog for choosing machine model when no command-line option was given

This commit is contained in:
Maik Merten 2014-07-22 17:50:06 +02:00
parent bd2337ae65
commit 222772648d

View File

@ -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() {