Code refactoring.
[sixth-3d-demos.git] / src / main / java / eu / svjatoslav / sixth / e3d / examples / launcher / ApplicationListPanel.java
diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/ApplicationListPanel.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/ApplicationListPanel.java
new file mode 100644 (file)
index 0000000..2b3b643
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * Sixth 3D engine demos. Author: Svjatoslav Agejenko. 
+ * This project is released under Creative Commons Zero (CC0) license.
+ *
+*/
+
+package eu.svjatoslav.sixth.e3d.examples.launcher;
+
+import eu.svjatoslav.sixth.e3d.examples.*;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+
+class ApplicationListPanel extends JPanel {
+    private static final long serialVersionUID = 2012721856427052560L;
+
+    ApplicationListPanel() {
+        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 ShowRain()));
+        sequentialGroup.addComponent(new JButton(new ShowTextEditors()));
+        sequentialGroup.addComponent(new JButton(new ShowTextEditors2()));
+        sequentialGroup.addComponent(new JButton(new ShowGameOfLife()));
+        sequentialGroup.addComponent(new JButton(new ShowRandomPolygons()));
+    }
+
+    private static class ShowTextEditors extends AbstractAction {
+        ShowTextEditors() {
+            putValue(NAME, "Text editors");
+        }
+
+        @Override
+        public void actionPerformed(final ActionEvent e) {
+            TextEditorDemo.main(null);
+        }
+    }
+
+    private static class ShowTextEditors2 extends AbstractAction {
+        ShowTextEditors2() {
+            putValue(NAME, "Text editors city");
+        }
+
+        @Override
+        public void actionPerformed(final ActionEvent e) {
+            TextEditorDemo2.main(null);
+        }
+    }
+
+
+    private static class ShowRain extends AbstractAction {
+        ShowRain() {
+            putValue(NAME, "Raining numbers");
+        }
+
+        @Override
+        public void actionPerformed(final ActionEvent e) {
+            RainingNumbersDemo.main(null);
+        }
+    }
+
+    private static class ShowPointCloud extends AbstractAction {
+        ShowPointCloud() {
+            putValue(NAME, "Point cloud galaxy");
+        }
+
+        @Override
+        public void actionPerformed(final ActionEvent e) {
+            PointCloudDemo.main(null);
+        }
+    }
+
+    private static class ShowMathGraphs extends AbstractAction {
+        ShowMathGraphs() {
+            putValue(NAME, "Mathematical graphs");
+        }
+
+        @Override
+        public void actionPerformed(final ActionEvent e) {
+            GraphDemo.main(null);
+        }
+    }
+
+    private static class ShowRandomPolygons extends AbstractAction {
+        ShowRandomPolygons() {
+            putValue(NAME, "Random polygons");
+        }
+
+        @Override
+        public void actionPerformed(final ActionEvent e) {
+            RandomPolygonsDemo.main(null);
+        }
+    }
+
+    private static class ShowOctree extends AbstractAction {
+        ShowOctree() {
+            putValue(NAME, "Volumetric Octree");
+        }
+
+        @Override
+        public void actionPerformed(final ActionEvent e) {
+            OctreeDemo.main(null);
+        }
+    }
+
+    private static class ShowGameOfLife extends AbstractAction {
+        ShowGameOfLife() {
+            putValue(NAME, "Game of Life");
+        }
+
+        @Override
+        public void actionPerformed(final ActionEvent e) {
+            eu.svjatoslav.sixth.e3d.examples.life_demo.Main.main(null);
+        }
+    }
+
+}