diff --git a/src/main/java/jace/Emulator.java b/src/main/java/jace/Emulator.java index fb1209b..0439358 100644 --- a/src/main/java/jace/Emulator.java +++ b/src/main/java/jace/Emulator.java @@ -21,19 +21,10 @@ package jace; import jace.apple2e.Apple2e; import jace.config.Configuration; import jace.ui.AbstractEmulatorFrame; -import jace.ui.EmulatorFrame; import java.awt.Component; -import java.awt.event.ComponentEvent; -import java.awt.event.ComponentListener; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import java.io.IOException; import java.util.HashMap; +import java.util.List; import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.imageio.ImageIO; -import javax.swing.JFrame; /** * Created on January 15, 2007, 10:10 PM @@ -44,10 +35,10 @@ public class Emulator { public static Emulator instance; public static Thread mainThread; - public static void main(String... args) { - mainThread = Thread.currentThread(); - instance = new Emulator(args); - } +// public static void main(String... args) { +// mainThread = Thread.currentThread(); +// instance = new Emulator(args); +// } public static Apple2e computer; public AbstractEmulatorFrame theApp; @@ -56,16 +47,17 @@ public class Emulator { * Creates a new instance of Emulator * @param args */ - public Emulator(String... args) { + public Emulator(List args) { computer = new Apple2e(); Configuration.loadSettings(); + mainThread = Thread.currentThread(); Map settings = new HashMap<>(); if (args != null) { - for (int i = 0; i < args.length; i++) { - if (args[i].startsWith("-")) { - String key = args[i].substring(1); - if ((i + 1) < args.length) { - String val = args[i + 1]; + for (int i = 0; i < args.size(); i++) { + if (args.get(i).startsWith("-")) { + String key = args.get(i).substring(1); + if ((i + 1) < args.size()) { + String val = args.get(i + 1); if (!val.startsWith("-")) { settings.put(key, val); i++; @@ -76,7 +68,7 @@ public class Emulator { settings.put(key, "true"); } } else { - System.err.println("Did not understand parameter " + args[i] + ", skipping."); + System.err.println("Did not understand parameter " + args.get(i) + ", skipping."); } } } diff --git a/src/main/java/jace/JaceApplication.java b/src/main/java/jace/JaceApplication.java index 408b5d0..9999bf3 100644 --- a/src/main/java/jace/JaceApplication.java +++ b/src/main/java/jace/JaceApplication.java @@ -39,15 +39,15 @@ public class JaceApplication extends Application { } primaryStage.show(); - Emulator e = new Emulator(); + Emulator emulator = new Emulator(getParameters().getRaw()); javafx.application.Platform.runLater(() -> { while (Emulator.computer.getVideo() == null || Emulator.computer.getVideo().getFrameBuffer() == null) { Thread.yield(); } controller.connectComputer(Emulator.computer); }); - primaryStage.setOnCloseRequest(value -> { - Emulator.computer.deactivate(); + primaryStage.setOnCloseRequest(event->{ + emulator.computer.deactivate(); Platform.exit(); System.exit(0); }); diff --git a/src/main/java/jace/core/Utility.java b/src/main/java/jace/core/Utility.java index 38cb31e..14ce138 100644 --- a/src/main/java/jace/core/Utility.java +++ b/src/main/java/jace/core/Utility.java @@ -18,7 +18,6 @@ */ package jace.core; -import jace.Emulator; import java.awt.BorderLayout; import java.awt.EventQueue; import java.io.File; @@ -46,9 +45,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.BorderFactory; import javax.swing.ImageIcon; -import javax.swing.JDialog; import javax.swing.JLabel; -import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JProgressBar; @@ -96,7 +93,7 @@ public class Utility { try { // Try to create an instance of the object String className = pckgname + "." + classname; - System.out.println("Class: " + className); +// System.out.println("Class: " + className); Class c = Class.forName(className); if (clazz.isAssignableFrom(c)) { output.add(c);