Changed license to Creative Commons Zero (CC0).
[sixth-3d-demos.git] / src / main / java / eu / svjatoslav / sixth / e3d / examples / launcher / MenuPanel.java
1 /*
2  * Sixth 3D engine demos. Author: Svjatoslav Agejenko. 
3  * This project is released under Creative Commons Zero (CC0) license.
4  *
5 */
6
7 package eu.svjatoslav.sixth.e3d.examples.launcher;
8
9 import eu.svjatoslav.sixth.e3d.examples.*;
10
11 import javax.swing.*;
12 import java.awt.event.ActionEvent;
13 import java.io.IOException;
14
15 class MenuPanel extends JPanel {
16     private static final long serialVersionUID = 2012721856427052560L;
17
18     MenuPanel() {
19         final GroupLayout groupLayout = new GroupLayout(this);
20         GroupLayout.SequentialGroup sequentialGroup = groupLayout.createSequentialGroup();
21         sequentialGroup.addComponent(new JLabel("Choose an example to launch:"));
22         sequentialGroup.addComponent(new JButton(new ShowOctree()));
23         sequentialGroup.addComponent(new JButton(new ShowMathGraphs()));
24         sequentialGroup.addComponent(new JButton(new ShowPointCloud()));
25         sequentialGroup.addComponent(new JButton(new ShowRain()));
26         sequentialGroup.addComponent(new JButton(new ShowSinusMap()));
27         sequentialGroup.addComponent(new JButton(new ShowTextEditors()));
28         sequentialGroup.addComponent(new JButton(new ShowGameOfLife()));
29         sequentialGroup.addComponent(new JButton(new ShowRandomPolygons()));
30     }
31
32     private class ShowTextEditors extends AbstractAction {
33         ShowTextEditors() {
34             putValue(NAME, "Text editors");
35         }
36
37         @Override
38         public void actionPerformed(final ActionEvent e) {
39             TextEditorDemo.main(null);
40         }
41     }
42
43     private class ShowSinusMap extends AbstractAction {
44         ShowSinusMap() {
45             putValue(NAME, "Wireframe sphere and ploygon landscape");
46         }
47
48         @Override
49         public void actionPerformed(final ActionEvent e) {
50             SphereDemo.main(null);
51         }
52     }
53
54     private class ShowRain extends AbstractAction {
55         ShowRain() {
56             putValue(NAME, "Raining numbers");
57         }
58
59         @Override
60         public void actionPerformed(final ActionEvent e) {
61             RainingNumbersDemo.main(null);
62         }
63     }
64
65     private class ShowPointCloud extends AbstractAction {
66         ShowPointCloud() {
67             putValue(NAME, "Pointcloud galaxy");
68         }
69
70         @Override
71         public void actionPerformed(final ActionEvent e) {
72             PointCloudDemo.main(null);
73         }
74     }
75
76     private class ShowMathGraphs extends AbstractAction {
77         ShowMathGraphs() {
78             putValue(NAME, "Mathematical graphs");
79         }
80
81         @Override
82         public void actionPerformed(final ActionEvent e) {
83             try {
84                 GraphDemo.main(null);
85             } catch (final IOException e1) {
86                 e1.printStackTrace();
87             }
88         }
89     }
90
91     private class ShowRandomPolygons extends AbstractAction {
92         ShowRandomPolygons() {
93             putValue(NAME, "Random polygons");
94         }
95
96         @Override
97         public void actionPerformed(final ActionEvent e) {
98             RandomPolygonsDemo.main(null);
99         }
100     }
101
102     private class ShowOctree extends AbstractAction {
103         ShowOctree() {
104             putValue(NAME, "Volumetric Octree");
105         }
106
107         @Override
108         public void actionPerformed(final ActionEvent e) {
109             OctreeDemo.main(null);
110         }
111     }
112
113     private class ShowGameOfLife extends AbstractAction {
114         ShowGameOfLife() {
115             putValue(NAME, "Game of Life");
116         }
117
118         @Override
119         public void actionPerformed(final ActionEvent e) {
120             eu.svjatoslav.sixth.e3d.examples.life.Main.main(null);
121         }
122     }
123
124 }