Merged sphere demo and graph demo. Set default FPS to 60.
[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 ShowTextEditors()));
27         sequentialGroup.addComponent(new JButton(new ShowGameOfLife()));
28         sequentialGroup.addComponent(new JButton(new ShowRandomPolygons()));
29     }
30
31     private class ShowTextEditors extends AbstractAction {
32         ShowTextEditors() {
33             putValue(NAME, "Text editors");
34         }
35
36         @Override
37         public void actionPerformed(final ActionEvent e) {
38             TextEditorDemo.main(null);
39         }
40     }
41
42
43     private class ShowRain extends AbstractAction {
44         ShowRain() {
45             putValue(NAME, "Raining numbers");
46         }
47
48         @Override
49         public void actionPerformed(final ActionEvent e) {
50             RainingNumbersDemo.main(null);
51         }
52     }
53
54     private class ShowPointCloud extends AbstractAction {
55         ShowPointCloud() {
56             putValue(NAME, "Pointcloud galaxy");
57         }
58
59         @Override
60         public void actionPerformed(final ActionEvent e) {
61             PointCloudDemo.main(null);
62         }
63     }
64
65     private class ShowMathGraphs extends AbstractAction {
66         ShowMathGraphs() {
67             putValue(NAME, "Mathematical graphs");
68         }
69
70         @Override
71         public void actionPerformed(final ActionEvent e) {
72             try {
73                 GraphDemo.main(null);
74             } catch (final IOException e1) {
75                 e1.printStackTrace();
76             }
77         }
78     }
79
80     private class ShowRandomPolygons extends AbstractAction {
81         ShowRandomPolygons() {
82             putValue(NAME, "Random polygons");
83         }
84
85         @Override
86         public void actionPerformed(final ActionEvent e) {
87             RandomPolygonsDemo.main(null);
88         }
89     }
90
91     private class ShowOctree extends AbstractAction {
92         ShowOctree() {
93             putValue(NAME, "Volumetric Octree");
94         }
95
96         @Override
97         public void actionPerformed(final ActionEvent e) {
98             OctreeDemo.main(null);
99         }
100     }
101
102     private class ShowGameOfLife extends AbstractAction {
103         ShowGameOfLife() {
104             putValue(NAME, "Game of Life");
105         }
106
107         @Override
108         public void actionPerformed(final ActionEvent e) {
109             eu.svjatoslav.sixth.e3d.examples.life.Main.main(null);
110         }
111     }
112
113 }