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