2 * Sixth 3D engine demos. Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
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.
9 package eu.svjatoslav.sixth.e3d.examples.launcher;
11 import eu.svjatoslav.sixth.e3d.examples.*;
14 import javax.swing.GroupLayout.Alignment;
15 import javax.swing.LayoutStyle.ComponentPlacement;
16 import java.awt.event.ActionEvent;
17 import java.io.IOException;
19 class MenuPanel extends JPanel {
20 private static final long serialVersionUID = 2012721856427052560L;
24 final JLabel lblNewLabel = new JLabel("Choose an example to launch.");
26 final JButton btnNewButton = new JButton("Demo 1");
27 btnNewButton.addActionListener(e -> {
29 Action action = new SwingAction();
30 btnNewButton.setAction(action);
32 final JButton btnNewButton_1 = new JButton("Demo 2");
33 Action action_1 = new SwingAction_1();
34 btnNewButton_1.setAction(action_1);
36 final JButton button = new JButton("New button");
37 Action action_2 = new SwingAction_2();
38 button.setAction(action_2);
40 final JButton btnNewButton_2 = new JButton("New button");
41 Action action_3 = new SwingAction_3();
42 btnNewButton_2.setAction(action_3);
44 final JButton btnNewButton_3 = new JButton("New button");
45 Action action_4 = new SwingAction_4();
46 btnNewButton_3.setAction(action_4);
48 final JButton btnNewButton_4 = new JButton("New button");
49 Action action_5 = new SwingAction_5();
50 btnNewButton_4.setAction(action_5);
51 final GroupLayout groupLayout = new GroupLayout(this);
53 .setHorizontalGroup(groupLayout
54 .createParallelGroup(Alignment.LEADING)
57 .createSequentialGroup()
66 .createSequentialGroup()
69 GroupLayout.PREFERRED_SIZE,
71 GroupLayout.PREFERRED_SIZE)
73 GroupLayout.DEFAULT_SIZE,
78 .createSequentialGroup()
86 GroupLayout.DEFAULT_SIZE,
92 GroupLayout.DEFAULT_SIZE,
98 GroupLayout.DEFAULT_SIZE,
104 GroupLayout.DEFAULT_SIZE,
110 GroupLayout.DEFAULT_SIZE,
111 GroupLayout.DEFAULT_SIZE,
115 GroupLayout.DEFAULT_SIZE,
119 groupLayout.setVerticalGroup(groupLayout.createParallelGroup(
120 Alignment.LEADING).addGroup(
122 .createSequentialGroup()
124 .addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE,
125 58, GroupLayout.PREFERRED_SIZE)
126 .addPreferredGap(ComponentPlacement.RELATED)
127 .addComponent(btnNewButton)
128 .addPreferredGap(ComponentPlacement.RELATED)
129 .addComponent(btnNewButton_1)
130 .addPreferredGap(ComponentPlacement.RELATED)
131 .addComponent(button)
132 .addPreferredGap(ComponentPlacement.RELATED)
133 .addComponent(btnNewButton_2)
134 .addPreferredGap(ComponentPlacement.RELATED)
135 .addComponent(btnNewButton_3)
136 .addPreferredGap(ComponentPlacement.RELATED)
137 .addComponent(btnNewButton_4)
138 .addContainerGap(137, Short.MAX_VALUE)));
139 setLayout(groupLayout);
143 private class SwingAction extends AbstractAction {
144 private static final long serialVersionUID = 5197962166765841015L;
146 public SwingAction() {
147 putValue(NAME, "Text editors");
148 putValue(SHORT_DESCRIPTION, "Some short description");
152 public void actionPerformed(final ActionEvent e) {
153 TextEditorDemo.main(null);
157 private class SwingAction_1 extends AbstractAction {
158 private static final long serialVersionUID = -896479509963403828L;
160 public SwingAction_1() {
161 putValue(NAME, "Wireframe sphere and ploygon landscape");
162 putValue(SHORT_DESCRIPTION, "Some short description");
166 public void actionPerformed(final ActionEvent e) {
167 SphereDemo.main(null);
172 private class SwingAction_2 extends AbstractAction {
173 private static final long serialVersionUID = 8566009849873897321L;
175 public SwingAction_2() {
176 putValue(NAME, "Raining numbers");
177 putValue(SHORT_DESCRIPTION, "Some short description");
181 public void actionPerformed(final ActionEvent e) {
183 RainingNumbersDemo.main(null);
184 } catch (final IOException e1) {
185 e1.printStackTrace();
190 private class SwingAction_3 extends AbstractAction {
191 private static final long serialVersionUID = -5369105936409884389L;
193 public SwingAction_3() {
194 putValue(NAME, "Pointcloud galaxy");
195 putValue(SHORT_DESCRIPTION, "Some short description");
199 public void actionPerformed(final ActionEvent e) {
200 PointCloudDemo.main(null);
204 private class SwingAction_4 extends AbstractAction {
205 private static final long serialVersionUID = -8486796142555764460L;
207 public SwingAction_4() {
208 putValue(NAME, "Mathematical graphs");
209 putValue(SHORT_DESCRIPTION, "Some short description");
213 public void actionPerformed(final ActionEvent e) {
215 GraphDemo.main(null);
216 } catch (final IOException e1) {
217 e1.printStackTrace();
222 private class SwingAction_5 extends AbstractAction {
223 private static final long serialVersionUID = -6210703594848004946L;
225 public SwingAction_5() {
226 putValue(NAME, "Volumetric Octree");
227 putValue(SHORT_DESCRIPTION, "Some short description");
231 public void actionPerformed(final ActionEvent e) {
233 OctreeDemo.main(null);
234 } catch (final IOException e1) {
235 e1.printStackTrace();