Code refactoring.
[sixth-3d-demos.git] / src / main / java / eu / svjatoslav / sixth / e3d / examples / launcher / Main.java
index cb36ba7..07e5c39 100755 (executable)
@@ -1,39 +1,32 @@
 /*
- * Sixth 3D engine demos. Copyright ©2012-2019, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ * Sixth 3D engine demos. Author: Svjatoslav Agejenko. 
+ * This project is released under Creative Commons Zero (CC0) license.
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 3 of the GNU Lesser General Public License
- * or later as published by the Free Software Foundation.
- */
+*/
 
 package eu.svjatoslav.sixth.e3d.examples.launcher;
 
 import javax.swing.*;
 import java.awt.*;
 
-class Main extends javax.swing.JFrame {
-
-    private static final long serialVersionUID = -3679656169594556137L;
-
-    private Main() {
-        super();
-        initGUI();
-    }
+class Main {
 
     public static void main(final String[] args) {
-        SwingUtilities.invokeLater(() -> {
-            final Main inst = new Main();
-            final BorderLayout instLayout = new BorderLayout();
-            inst.setLocationRelativeTo(null);
-            inst.setVisible(true);
-            inst.getContentPane().setLayout(instLayout);
-        });
+        buildAndShowGuiWindow();
     }
 
-    private void initGUI() {
-        getContentPane().add(new MenuPanel());
-        pack();
-        setSize(390, 300);
+    private static void buildAndShowGuiWindow() {
+        JFrame frame = new JFrame("Sixth 3D engine demos");
+
+        // Keep application running until last frame is closed.
+        frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+
+        frame.getContentPane().setLayout(new BorderLayout());
+        frame.getContentPane().add(new ApplicationListPanel(), BorderLayout.CENTER);
+        frame.setSize(400, 300);
+
+        frame.setLocationRelativeTo(null); // center frame on screen
+        frame.setVisible(true);
     }
 
 }