Commit in java/trunk/monitoring-app/src/main/java/org/hps/monitoring on MAIN
MonitoringApplicationMain.java+3-1715 -> 716
gui/MonitoringApplication.java+26-25715 -> 716
+29-26
2 modified files
Make MonitoringApplication class extend JFrame.  Simplify creation of app.

java/trunk/monitoring-app/src/main/java/org/hps/monitoring
MonitoringApplicationMain.java 715 -> 716
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/MonitoringApplicationMain.java	2014-06-17 15:14:10 UTC (rev 715)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/MonitoringApplicationMain.java	2014-06-17 17:46:14 UTC (rev 716)
@@ -43,7 +43,7 @@
         }
 
         // Create the application class.
-        MonitoringApplication app = MonitoringApplication.createMonitoringApplication();
+        MonitoringApplication app = new MonitoringApplication();
 
         // Load the connection settings.
         if (cl.hasOption("c")) {
@@ -54,6 +54,8 @@
         if (cl.hasOption("j")) {
             app.loadJobSettings(new File(cl.getOptionValue("j")));
         }
+        
+        app.setVisible(true);
     }
     
 }

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
MonitoringApplication.java 715 -> 716
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/MonitoringApplication.java	2014-06-17 15:14:10 UTC (rev 715)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/MonitoringApplication.java	2014-06-17 17:46:14 UTC (rev 716)
@@ -98,7 +98,7 @@
 // TODO: Capture std err and out and redirect to a text panel within the application.
 // TODO: Report state of event processing at the end of the job in a new GUI component.
 // TODO: Move ET cleanup code to the record.etevent package.
-public class MonitoringApplication {
+public class MonitoringApplication extends JFrame {
 
     // Top-level Swing components.
     private JPanel mainPanel;
@@ -112,7 +112,6 @@
     private JobPanel jobPanel;
     private JMenuBar menuBar;
     private EventButtonsPanel buttonsPanel;
-    private JFrame frame;
 
     // References to menu items that will be enabled/disabled depending on application state.
     private JMenuItem connectItem;
@@ -187,7 +186,7 @@
     /**
      * Constructor for the monitoring application. 
      */
-    private MonitoringApplication() {
+    public MonitoringApplication() {
 
         // Create and configure the logger.
         setupLogger();
@@ -206,6 +205,8 @@
 
         // Setup AIDA.
         setupAida();
+        
+        configFrame();
 
         // Log that the application started successfully.
         log("Application initialized successfully.");
@@ -243,10 +244,10 @@
         leftPanel.setMinimumSize(new Dimension(leftPanelWidth, screenHeight - 30));
         leftPanel.setLayout(new GridBagLayout());
 
-        GridBagConstraints c = new GridBagConstraints();
-
+        GridBagConstraints c;
+        
         // Event processing buttons.
-        //c = new GridBagConstraints();
+        c = new GridBagConstraints();
         c.gridx = 0;
         c.gridy = 0;
         c.anchor = GridBagConstraints.CENTER;
@@ -532,17 +533,17 @@
      * Create the monitoring application frame and run it on a separate thread.
      * @return Reference to the created application.
      */
-    public static final MonitoringApplication createMonitoringApplication() {
-        final MonitoringApplication app = new MonitoringApplication();
-        SwingUtilities.invokeLater(new Runnable() {
+    //public static final MonitoringApplication createMonitoringApplication() {
+    //    return new MonitoringApplication(); 
+        //final MonitoringApplication app = new 
+        //SwingUtilities.invokeLater(new Runnable() {
+        //    public void run() {
+        //        app.setVisible(true);
+        //    }
+        //});
+        //return app;
+    //}
 
-            public void run() {
-                app.createApplicationFrame();
-            }
-        });
-        return app;
-    }
-
     /**
      * Load connection settings from a file.
      * @param file The properties file.
@@ -735,16 +736,16 @@
     /**
      * Setup the frame to run the application.
      */
-    private void createApplicationFrame() {
+    private void configFrame() {
         mainPanel.setOpaque(true);
-        frame = new JFrame(getApplicationTitle());
-        frame.setContentPane(mainPanel);
-        frame.setJMenuBar(menuBar);
-        frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
-        // frame.setMinimumSize(new Dimension(600, 850));
-        frame.setResizable(true);
-        frame.pack();    
-        frame.setVisible(true);
+        setTitle(getApplicationTitle());
+        setContentPane(mainPanel);
+        setJMenuBar(menuBar);
+        setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
+        //setMinimumSize();
+        setPreferredSize(new Dimension(screenWidth, screenHeight));
+        setResizable(true);
+        pack();    
     }
 
     /**
SVNspam 0.1