0a6079823cd778a85954260371fea74a4638ed1e
[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
14 class MenuPanel extends JPanel {
15     private static final long serialVersionUID = 2012721856427052560L;
16
17     MenuPanel() {
18         final GroupLayout groupLayout = new GroupLayout(this);
19         GroupLayout.SequentialGroup sequentialGroup = groupLayout.createSequentialGroup();
20         sequentialGroup.addComponent(new JLabel("Choose an example to launch:"));
21         sequentialGroup.addComponent(new JButton(new ShowOctree()));
22         sequentialGroup.addComponent(new JButton(new ShowMathGraphs()));
23         sequentialGroup.addComponent(new JButton(new ShowPointCloud()));
24         sequentialGroup.addComponent(new JButton(new ShowRain()));
25         sequentialGroup.addComponent(new JButton(new ShowTextEditors()));
26         sequentialGroup.addComponent(new JButton(new ShowGameOfLife()));
27         sequentialGroup.addComponent(new JButton(new ShowRandomPolygons()));
28     }
29
30     private static class ShowTextEditors extends AbstractAction {
31         ShowTextEditors() {
32             putValue(NAME, "Text editors");
33         }
34
35         @Override
36         public void actionPerformed(final ActionEvent e) {
37             TextEditorDemo.main(null);
38         }
39     }
40
41
42     private static class ShowRain extends AbstractAction {
43         ShowRain() {
44             putValue(NAME, "Raining numbers");
45         }
46
47         @Override
48         public void actionPerformed(final ActionEvent e) {
49             RainingNumbersDemo.main(null);
50         }
51     }
52
53     private static class ShowPointCloud extends AbstractAction {
54         ShowPointCloud() {
55             putValue(NAME, "Pointcloud galaxy");
56         }
57
58         @Override
59         public void actionPerformed(final ActionEvent e) {
60             PointCloudDemo.main(null);
61         }
62     }
63
64     private static class ShowMathGraphs extends AbstractAction {
65         ShowMathGraphs() {
66             putValue(NAME, "Mathematical graphs");
67         }
68
69         @Override
70         public void actionPerformed(final ActionEvent e) {
71             GraphDemo.main(null);
72         }
73     }
74
75     private static class ShowRandomPolygons extends AbstractAction {
76         ShowRandomPolygons() {
77             putValue(NAME, "Random polygons");
78         }
79
80         @Override
81         public void actionPerformed(final ActionEvent e) {
82             RandomPolygonsDemo.main(null);
83         }
84     }
85
86     private static class ShowOctree extends AbstractAction {
87         ShowOctree() {
88             putValue(NAME, "Volumetric Octree");
89         }
90
91         @Override
92         public void actionPerformed(final ActionEvent e) {
93             OctreeDemo.main(null);
94         }
95     }
96
97     private static class ShowGameOfLife extends AbstractAction {
98         ShowGameOfLife() {
99             putValue(NAME, "Game of Life");
100         }
101
102         @Override
103         public void actionPerformed(final ActionEvent e) {
104             eu.svjatoslav.sixth.e3d.examples.life.Main.main(null);
105         }
106     }
107
108 }