Code refactoring
[sixth-3d-demos.git] / src / main / java / eu / svjatoslav / sixth / e3d / examples / launcher / MenuPanel.java
index 10178e3..0a60798 100644 (file)
@@ -1,10 +1,8 @@
 /*
- * Sixth 3D engine demos. Copyright ©2012-2016, 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;
 
@@ -12,27 +10,25 @@ import eu.svjatoslav.sixth.e3d.examples.*;
 
 import javax.swing.*;
 import java.awt.event.ActionEvent;
-import java.io.IOException;
 
 class MenuPanel extends JPanel {
     private static final long serialVersionUID = 2012721856427052560L;
 
-    public MenuPanel() {
-
+    MenuPanel() {
         final GroupLayout groupLayout = new GroupLayout(this);
         GroupLayout.SequentialGroup sequentialGroup = groupLayout.createSequentialGroup();
         sequentialGroup.addComponent(new JLabel("Choose an example to launch:"));
         sequentialGroup.addComponent(new JButton(new ShowOctree()));
         sequentialGroup.addComponent(new JButton(new ShowMathGraphs()));
-        sequentialGroup.addComponent(new JButton(new ShowPointcloud()));
+        sequentialGroup.addComponent(new JButton(new ShowPointCloud()));
         sequentialGroup.addComponent(new JButton(new ShowRain()));
-        sequentialGroup.addComponent(new JButton(new ShowSinusMap()));
         sequentialGroup.addComponent(new JButton(new ShowTextEditors()));
         sequentialGroup.addComponent(new JButton(new ShowGameOfLife()));
+        sequentialGroup.addComponent(new JButton(new ShowRandomPolygons()));
     }
 
-    private class ShowTextEditors extends AbstractAction {
-        public ShowTextEditors() {
+    private static class ShowTextEditors extends AbstractAction {
+        ShowTextEditors() {
             putValue(NAME, "Text editors");
         }
 
@@ -42,75 +38,64 @@ class MenuPanel extends JPanel {
         }
     }
 
-    private class ShowSinusMap extends AbstractAction {
-        public ShowSinusMap() {
-            putValue(NAME, "Wireframe sphere and ploygon landscape");
+
+    private static class ShowRain extends AbstractAction {
+        ShowRain() {
+            putValue(NAME, "Raining numbers");
         }
 
         @Override
         public void actionPerformed(final ActionEvent e) {
-            SphereDemo.main(null);
+            RainingNumbersDemo.main(null);
         }
     }
 
-    private class ShowRain extends AbstractAction {
-        public ShowRain() {
-            putValue(NAME, "Raining numbers");
+    private static class ShowPointCloud extends AbstractAction {
+        ShowPointCloud() {
+            putValue(NAME, "Pointcloud galaxy");
         }
 
         @Override
         public void actionPerformed(final ActionEvent e) {
-            try {
-                RainingNumbersDemo.main(null);
-            } catch (final IOException e1) {
-                e1.printStackTrace();
-            }
+            PointCloudDemo.main(null);
         }
     }
 
-    private class ShowPointcloud extends AbstractAction {
-        public ShowPointcloud() {
-            putValue(NAME, "Pointcloud galaxy");
+    private static class ShowMathGraphs extends AbstractAction {
+        ShowMathGraphs() {
+            putValue(NAME, "Mathematical graphs");
         }
 
         @Override
         public void actionPerformed(final ActionEvent e) {
-            PointCloudDemo.main(null);
+            GraphDemo.main(null);
         }
     }
 
-    private class ShowMathGraphs extends AbstractAction {
-        public ShowMathGraphs() {
-            putValue(NAME, "Mathematical graphs");
+    private static class ShowRandomPolygons extends AbstractAction {
+        ShowRandomPolygons() {
+            putValue(NAME, "Random polygons");
         }
 
         @Override
         public void actionPerformed(final ActionEvent e) {
-            try {
-                GraphDemo.main(null);
-            } catch (final IOException e1) {
-                e1.printStackTrace();
-            }
+            RandomPolygonsDemo.main(null);
         }
     }
 
-    private class ShowOctree extends AbstractAction {
-        public ShowOctree() {
+    private static class ShowOctree extends AbstractAction {
+        ShowOctree() {
             putValue(NAME, "Volumetric Octree");
         }
 
         @Override
         public void actionPerformed(final ActionEvent e) {
-            try {
-                OctreeDemo.main(null);
-            } catch (final IOException e1) {
-                e1.printStackTrace();
-            }
+            OctreeDemo.main(null);
         }
     }
 
-    private class ShowGameOfLife extends AbstractAction {
-        public ShowGameOfLife() {
+    private static class ShowGameOfLife extends AbstractAction {
+        ShowGameOfLife() {
             putValue(NAME, "Game of Life");
         }