summaryrefslogtreecommitdiff
path: root/src/tesseract/menuitems
diff options
context:
space:
mode:
Diffstat (limited to 'src/tesseract/menuitems')
-rw-r--r--src/tesseract/menuitems/ChainLinkMenuItem.java90
-rw-r--r--src/tesseract/menuitems/DonutMenuItem.java136
-rw-r--r--src/tesseract/menuitems/EllipsoidMenuItem.java81
-rw-r--r--src/tesseract/menuitems/GravityMenuItem.java38
-rw-r--r--src/tesseract/menuitems/IcosahedronMenuItem.java79
-rw-r--r--src/tesseract/menuitems/ParticleEmitterMenuItem.java86
-rw-r--r--src/tesseract/menuitems/ParticleMenuItem.java50
-rw-r--r--src/tesseract/menuitems/PlanarPolygonMenuItem.java80
-rw-r--r--src/tesseract/menuitems/SurfBoardMenuItem.java89
-rw-r--r--src/tesseract/menuitems/TesseractMenuItem.java260
10 files changed, 0 insertions, 989 deletions
diff --git a/src/tesseract/menuitems/ChainLinkMenuItem.java b/src/tesseract/menuitems/ChainLinkMenuItem.java
deleted file mode 100644
index ca32af7..0000000
--- a/src/tesseract/menuitems/ChainLinkMenuItem.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package tesseract.menuitems;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JFrame;
-import javax.vecmath.Vector3f;
-
-import tesseract.World;
-import tesseract.objects.ChainLink2;
-
-/**
- * Icosahedron Menu Item.
- *
- * @author Steve Bradshaw
- * @deprecated By Phillip Cardon
- */
-public class ChainLinkMenuItem extends TesseractMenuItem {
-
- /**
- * Serial ID.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor for the menu item.
- *
- * @param theWorld The world into which we add.
- */
- public ChainLinkMenuItem(final World theWorld) {
- super(theWorld, "ChainLink");
- }
-
- /**
- * Action handler.
- *
- * @param arg0 Unused event info.
- */
- public void actionPerformed(final ActionEvent arg0) {
- createParameterMenu();
-
- final float scale = 0.5f;
- //final float sliceRadius = .06f; //inside whole
- //final int sliceDivisions = 50;
- //final float arcRadius = .08f; //outside whole
- //final int arcDivisions = 30;
-
- //If the default button is checked, the frame will close.
- final JCheckBox defaultButton = getDefaultButton();
- final JFrame params = getParamFrame();
- final JButton enterButton = getEnterButton();
-
- defaultButton.addActionListener(new ActionListener() {
- public void actionPerformed(final ActionEvent e) {
- if (defaultButton.isSelected()) {
- myWorld.addObject(new ChainLink2(getDefaultPosition(), 1, getDefaultRadius()));
- params.dispose();
- /*myWorld.addObject(new ChainLink(getDefaultPosition(), 1, scale,
- sliceRadius, sliceDivisions, arcRadius, arcDivisions));
- params.dispose();*/
- }
- }
- });
-
- enterButton.addActionListener(new ActionListener() {
- public void actionPerformed(final ActionEvent event) {
- String string = getPositionField().getText();
- Vector3f pos = parseVector(string);
- setPosition(pos);
-
- String string2 = getRadiusField().getText();
- float radius = Float.parseFloat(string2);
- setRadius(radius);
-
- String string3 = getMassField().getText();
- float mass = Float.parseFloat(string3);
- setMass(mass);
-
- if (event.getSource() == enterButton) {
- myWorld.addObject(new ChainLink2(getPosition(), getMass(), getRadius()));
- params.dispose();
- }
- }
- });
- }
-}
-
-
diff --git a/src/tesseract/menuitems/DonutMenuItem.java b/src/tesseract/menuitems/DonutMenuItem.java
deleted file mode 100644
index 7fd4470..0000000
--- a/src/tesseract/menuitems/DonutMenuItem.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package tesseract.menuitems;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JTextField;
-import javax.vecmath.Vector3f;
-
-import tesseract.World;
-import tesseract.objects.Toroid;
-
-/**
- * Icosahedron Menu Item.
- *
- * @author Steve Bradshaw
- * @deprecated By Phillip Cardon
- */
-public class DonutMenuItem extends TesseractMenuItem {
-
- /**
- * Serial ID.
- */
- private static final long serialVersionUID = 1L;
-
- private float scale = 1f;
- private float sliceRadius = .06f; //inside whole
- private int sliceDivisions = 25;
- private float arcRadius = .08f; //outside whole
- private int arcDivisions = 30;
-
- /**
- * Constructor for the menu item.
- *
- * @param theWorld The world into which we add.
- */
- public DonutMenuItem(final World theWorld) {
- super(theWorld, "Donut");
- }
-
- /**
- * Action handler.
- *
- * @param arg0 Unused event info.
- */
- public void actionPerformed(final ActionEvent arg0) {
-
- createParameterMenu();
-
- //If the default button is checked, the frame will close.
- final JCheckBox defaultButton = getDefaultButton();
- final JFrame params = getParamFrame();
- /* final JButton enterButton = getEnterButton();
-
- final JTextField scale_input = new JTextField(10);
- scale_input.setText("1");
- final JTextField sliceRadiusInput = new JTextField(10);
- sliceRadiusInput.setText(".06");
- final JTextField sliceDivisionsInput = new JTextField(10);
- sliceDivisionsInput.setText("50");
- final JTextField arcRadiusInput = new JTextField(10);
- arcRadiusInput.setText(".08");
- final JTextField arcDivisionsInput = new JTextField(10);
- arcDivisionsInput.setText("30");
-
- JLabel scale_label = new JLabel("scale: ");
- JLabel slice_radius_label = new JLabel("sliceRadius: ");
- JLabel slice_divs_label = new JLabel("sliceDivs: ");
- JLabel arc_radius_label = new JLabel("arcRadius: ");
- JLabel arc_divs_label = new JLabel("arcDivs: ");
-
- params.add(scale_label);
- params.add(scale_input);
- params.add(slice_radius_label);
- params.add(sliceRadiusInput);
- params.add(slice_divs_label);
- params.add(sliceDivisionsInput);
- params.add(arc_radius_label);
- params.add(arcRadiusInput);
- params.add(arc_divs_label);
- params.add(arcDivisionsInput);
-
-
- params.add(enterButton);*/
-
- defaultButton.addActionListener(new ActionListener() {
- public void actionPerformed(final ActionEvent e) {
- if (defaultButton.isSelected()) {
- myWorld.addObject(new Toroid(getDefaultPosition(), 1, scale,
- sliceRadius, sliceDivisions, arcRadius, arcDivisions));
- params.dispose();
- }
- }
- });
-
- /*enterButton.addActionListener(new ActionListener() {
- public void actionPerformed(final ActionEvent event) {
-
- String string = getPositionField().getText();
- Vector3f pos = parseVector(string);
- setPosition(pos);
-
- String string3 = getMassField().getText();
- float mass = Float.parseFloat(string3);
- setMass(mass);
-
- String string4 = getMassField().getText();
- scale = Float.parseFloat(string4);
-
- String string5 = getMassField().getText();
- sliceRadius = Float.parseFloat(string5);
-
- String string6 = getMassField().getText();
- sliceDivisions = Integer.parseInt(string6);
-
- String string7 = getMassField().getText();
- arcRadius = Float.parseFloat(string7);
-
- String string8 = getMassField().getText();
- arcDivisions = Integer.parseInt(string8);
-
- if (event.getSource() == enterButton) {
- myWorld.addObject(new Toroid(pos, 1, scale,
- sliceRadius, sliceDivisions, arcRadius, arcDivisions));
- params.dispose();
- }
- }
- });*/
- }
-}
-
-
-
diff --git a/src/tesseract/menuitems/EllipsoidMenuItem.java b/src/tesseract/menuitems/EllipsoidMenuItem.java
deleted file mode 100644
index 02d7eb2..0000000
--- a/src/tesseract/menuitems/EllipsoidMenuItem.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package tesseract.menuitems;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JFrame;
-import javax.vecmath.Vector3f;
-
-import tesseract.World;
-import tesseract.objects.Ellipsoid;
-
-/**
- * Ellipsoid Menu Item.
- *
- * @author Steve Bradshaw
- * @deprecated By Phillip Cardon
- */
-public class EllipsoidMenuItem extends TesseractMenuItem {
-
- /**
- * Serial ID.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor for the menu item.
- *
- * @param theWorld The world into which we add.
- */
- public EllipsoidMenuItem(final World theWorld) {
- super(theWorld, "Ellipsoid");
- }
-
- /**
- * Action handler.
- *
- * @param arg0 Unused event info.
- */
- public void actionPerformed(final ActionEvent arg0) {
-
- createParameterMenu();
-
- //If the default button is checked, the frame will close.
- final JCheckBox defaultButton = getDefaultButton();
- final JFrame params = getParamFrame();
- final JButton enterButton = getEnterButton();
-
- defaultButton.addActionListener(new ActionListener() {
- public void actionPerformed(final ActionEvent ev) {
- if (defaultButton.isSelected()) {
- myWorld.addObject(new Ellipsoid(getDefaultPosition(), getDefaultRadius()));
- params.dispose();
- }
- }
- });
-
- enterButton.addActionListener(new ActionListener() {
- public void actionPerformed(final ActionEvent event) {
- String string = getPositionField().getText();
- Vector3f pos = parseVector(string);
- setPosition(pos);
-
- String string2 = getRadiusField().getText();
- float radius = Float.parseFloat(string2);
- setRadius(radius);
-
- String string3 = getMassField().getText();
- float mass = Float.parseFloat(string3);
- setMass(mass);
-
- if (event.getSource() == enterButton) {
- myWorld.addObject(new Ellipsoid(getPosition(), getRadius()));
- params.dispose();
- }
- }
- });
-
- }
-}
diff --git a/src/tesseract/menuitems/GravityMenuItem.java b/src/tesseract/menuitems/GravityMenuItem.java
deleted file mode 100644
index 4e11e71..0000000
--- a/src/tesseract/menuitems/GravityMenuItem.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package tesseract.menuitems;
-
-import java.awt.event.ActionEvent;
-
-import tesseract.World;
-import tesseract.forces.Gravity;
-
-/**
- * Gravity Menu Item.
- *
- * @author Steve Bradshaw
- * @deprecated by Phillip Cardon
- */
-public class GravityMenuItem extends TesseractMenuItem {
-
- /**
- * Serial ID.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor for the menu item.
- *
- * @param theWorld The world into which we add.
- */
- public GravityMenuItem(final World theWorld) {
- super(theWorld, "Gravity");
- }
-
- /**
- * Action handler.
- *
- * @param arg0 Unused event info.
- */
- public void actionPerformed(final ActionEvent arg0) {
- myWorld.addForce(new Gravity());
- }
-}
diff --git a/src/tesseract/menuitems/IcosahedronMenuItem.java b/src/tesseract/menuitems/IcosahedronMenuItem.java
deleted file mode 100644
index 550f954..0000000
--- a/src/tesseract/menuitems/IcosahedronMenuItem.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package tesseract.menuitems;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JFrame;
-import javax.vecmath.Vector3f;
-
-import tesseract.World;
-import tesseract.objects.Icosahedron;
-
-/**
- * Icosahedron Menu Item.
- *
- * @author Steve Bradshaw
- * @deprecated By Phillip Cardon
- */
-public class IcosahedronMenuItem extends TesseractMenuItem {
-
- /**
- * Serial ID.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor for the menu item.
- *
- * @param theWorld The world into which we add.
- */
- public IcosahedronMenuItem(final World theWorld) {
- super(theWorld, "Icosahedron");
- }
-
- /**
- * Action handler.
- *
- * @param arg0 Unused event info.
- */
- public void actionPerformed(final ActionEvent arg0) {
- createParameterMenu();
-
- //If the default button is checked, the frame will close.
- final JCheckBox defaultButton = getDefaultButton();
- final JFrame params = getParamFrame();
- final JButton enterButton = getEnterButton();
-
- defaultButton.addActionListener(new ActionListener() {
- public void actionPerformed(final ActionEvent e) {
- if (defaultButton.isSelected()) {
- myWorld.addObject(new Icosahedron(getDefaultPosition(), 1, getDefaultRadius()));
- params.dispose();
- }
- }
- });
- enterButton.addActionListener(new ActionListener() {
- public void actionPerformed(final ActionEvent event) {
- String string = getPositionField().getText();
- Vector3f pos = parseVector(string);
- setPosition(pos);
-
- String string2 = getRadiusField().getText();
- float radius = Float.parseFloat(string2);
- setRadius(radius);
-
- String string3 = getMassField().getText();
- float mass = Float.parseFloat(string3);
- setMass(mass);
-
- if (event.getSource() == enterButton) {
- myWorld.addObject(new Icosahedron(getPosition(), getMass(), getRadius()));
- params.dispose();
- }
- }
- });
- }
-}
-
diff --git a/src/tesseract/menuitems/ParticleEmitterMenuItem.java b/src/tesseract/menuitems/ParticleEmitterMenuItem.java
deleted file mode 100644
index f8456d2..0000000
--- a/src/tesseract/menuitems/ParticleEmitterMenuItem.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package tesseract.menuitems;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JFrame;
-import javax.vecmath.Color3f;
-import javax.vecmath.Vector3f;
-
-import tesseract.World;
-import tesseract.objects.emitters.ParticleEmitter;
-
-/**
- * Particle Emitter Menu Item.
- *
- * @author Jesse Morgan
- * @deprecated By Phillip Cardon
- */
-public class ParticleEmitterMenuItem extends TesseractMenuItem {
-
- /**
- * Serial ID.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor for the menu item.
- *
- * @param theWorld The world into which we add.
- */
- public ParticleEmitterMenuItem(final World theWorld) {
- super(theWorld, "Particle Emitter");
- }
-
- /**
- * Action handler.
- *
- * @param arg0 Unused event info.
- */
- public void actionPerformed(final ActionEvent arg0) {
- createParameterMenu();
-
-
-
- //If the default button is checked, the frame will close.
- final JCheckBox defaultButton = getDefaultButton();
- final JFrame params = getParamFrame();
- final JButton enterButton = getEnterButton();
-
- defaultButton.addActionListener(new ActionListener() {
- public void actionPerformed(final ActionEvent e) {
- if (defaultButton.isSelected()) {
- myWorld.addObject(new ParticleEmitter(
- new Vector3f(0f,.49f, 0f),
- .5f, new Color3f(1f,0f,0f)));
- params.dispose();
- }
- }
- });
-
- enterButton.addActionListener(new ActionListener() {
- public void actionPerformed(final ActionEvent event) {
- String string = getPositionField().getText();
- Vector3f pos = parseVector(string);
- setPosition(pos);
-
- String string2 = getRadiusField().getText();
- float radius = Float.parseFloat(string2);
- setRadius(radius);
-
- String string3 = getMassField().getText();
- float mass = Float.parseFloat(string3);
- setMass(mass);
-
- if (event.getSource() == enterButton) {
- myWorld.addObject(new ParticleEmitter(getPosition(),
- .5f, new Color3f(1f,0f,0f)));
- params.dispose();
- }
- }
- });
- }
-
-}
diff --git a/src/tesseract/menuitems/ParticleMenuItem.java b/src/tesseract/menuitems/ParticleMenuItem.java
deleted file mode 100644
index 822266c..0000000
--- a/src/tesseract/menuitems/ParticleMenuItem.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package tesseract.menuitems;
-
-import java.awt.Color;
-import java.awt.event.ActionEvent;
-
-import javax.swing.JColorChooser;
-import javax.swing.JOptionPane;
-import javax.vecmath.Color3f;
-import javax.vecmath.Vector3f;
-
-import tesseract.World;
-import tesseract.objects.Particle;
-
-/**
- * Particle Menu Item.
- *
- * @author Jesse Morgan
- * @deprecated By Phillip Cardon
- */
-public class ParticleMenuItem extends TesseractMenuItem {
-
- /**
- * Serial ID.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor for the menu item.
- *
- * @param theWorld The world into which we add.
- */
- public ParticleMenuItem(final World theWorld) {
- super(theWorld, "Particle");
- }
-
- /**
- * Action handler.
- *
- * @param arg0 Unused event info.
- */
- public void actionPerformed(final ActionEvent arg0) {
- Color c = JColorChooser.showDialog(null, "Particle Color", Color.RED);
-
- Vector3f pos =
- parseVector(JOptionPane.showInputDialog("Enter the position"));
-
- myWorld.addObject(new Particle(pos, new Color3f(c)));
- }
-
-}
diff --git a/src/tesseract/menuitems/PlanarPolygonMenuItem.java b/src/tesseract/menuitems/PlanarPolygonMenuItem.java
deleted file mode 100644
index 5c1f583..0000000
--- a/src/tesseract/menuitems/PlanarPolygonMenuItem.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package tesseract.menuitems;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JFrame;
-import javax.vecmath.Vector3f;
-
-import tesseract.World;
-import tesseract.objects.PlanarPolygon;
-
-/**
- * Planar Polygon Menu Item.
- *
- * @author Steve Bradshaw
- * @deprecated By Phillip Cardon
- */
-public class PlanarPolygonMenuItem extends TesseractMenuItem {
-
- /**
- * Serial ID.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor for the menu item.
- *
- * @param theWorld The world into which we add.
- */
- public PlanarPolygonMenuItem(final World theWorld) {
- super(theWorld, "Planar Polygon");
- }
-
- /**
- * Action handler.
- *
- * @param arg0 Unused event info.
- */
- public void actionPerformed(final ActionEvent arg0) {
- createParameterMenu();
-
- //If the default button is checked, the frame will close.
- final JCheckBox defaultButton = getDefaultButton();
- final JFrame params = getParamFrame();
- final JButton enterButton = getEnterButton();
-
- defaultButton.addActionListener(new ActionListener() {
- public void actionPerformed(final ActionEvent ev) {
- if (defaultButton.isSelected()) {
- myWorld.addObject(new PlanarPolygon(getDefaultPosition(), getDefaultRadius()));
- params.dispose();
- }
- }
- });
-
- enterButton.addActionListener(new ActionListener() {
- final int divs = 5;
- public void actionPerformed(final ActionEvent event) {
- String string = getPositionField().getText();
- Vector3f pos = parseVector(string);
- setPosition(pos);
-
- String string2 = getRadiusField().getText();
- float radius = Float.parseFloat(string2);
- setRadius(radius);
-
- String string3 = getMassField().getText();
- float mass = Float.parseFloat(string3);
- setMass(mass);
-
- if (event.getSource() == enterButton) {
- myWorld.addObject(new PlanarPolygon(getPosition(), getMass(), getRadius(), divs));
- params.dispose();
- }
- }
- });
- }
-}
diff --git a/src/tesseract/menuitems/SurfBoardMenuItem.java b/src/tesseract/menuitems/SurfBoardMenuItem.java
deleted file mode 100644
index c96fb3e..0000000
--- a/src/tesseract/menuitems/SurfBoardMenuItem.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package tesseract.menuitems;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.media.j3d.Appearance;
-import javax.media.j3d.ColoringAttributes;
-import javax.media.j3d.Material;
-import javax.swing.JCheckBox;
-import javax.swing.JFrame;
-
-import tesseract.World;
-import tesseract.objects.Ellipsoid;
-
-import com.sun.j3d.utils.geometry.Sphere;
-
-/**
- * Ellipsoid Menu Item.
- *
- * @author Steve Bradshaw
- * @deprecated by Phillip Cardon
- */
-public class SurfBoardMenuItem extends TesseractMenuItem {
-
- /**
- * Serial ID.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor for the menu item.
- *
- * @param theWorld The world into which we add.
- */
- public SurfBoardMenuItem(final World theWorld) {
- super(theWorld, "SurfBoard");
- }
-
- /**
- * Action handler.
- *
- * @param arg0 Unused event info.
- */
- public void actionPerformed(final ActionEvent arg0) {
-
- createParameterMenu();
-
- //If the default button is checked, the frame will close.
- final JCheckBox defaultButton = getDefaultButton();
- final JFrame params = getParamFrame();
- //final JButton enterButton = getEnterButton();
-
- defaultButton.addActionListener(new ActionListener() {
- public void actionPerformed(final ActionEvent ev) {
- if (defaultButton.isSelected()) {
- Appearance eApp = new Appearance();
- Material eggMat = new Material();
- eggMat.setDiffuseColor(0f, .5f, 1f);
- eApp.setMaterial(eggMat);
- eApp.setColoringAttributes(new ColoringAttributes(0f, 1f, 1f, ColoringAttributes.ALLOW_COLOR_WRITE));
- myWorld.addObject(new Ellipsoid(getPosition(), 1, 0.05f, new Sphere().getPrimitiveFlags(), 40, eApp, 0.2f, 4.0f));
- params.dispose();
- }
- }
- });
-
- /*enterButton.addActionListener(new ActionListener() {
- public void actionPerformed(final ActionEvent event) {
- String string = getPositionField().getText();
- Vector3f pos = parseVector(string);
- setPosition(pos);
-
- String string2 = getRadiusField().getText();
- float radius = Float.parseFloat(string2);
- setRadius(radius);
-
- String string3 = getMassField().getText();
- float mass = Float.parseFloat(string3);
- setMass(mass);
-
- if (event.getSource() == enterButton) {
- myWorld.addObject(new Ellipsoid(getPosition(), getRadius()));
- params.dispose();
- }
- }
- });*/
-
- }
-}
diff --git a/src/tesseract/menuitems/TesseractMenuItem.java b/src/tesseract/menuitems/TesseractMenuItem.java
deleted file mode 100644
index 97daa0c..0000000
--- a/src/tesseract/menuitems/TesseractMenuItem.java
+++ /dev/null
@@ -1,260 +0,0 @@
-package tesseract.menuitems;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.GridLayout;
-import java.awt.Toolkit;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JMenuItem;
-import javax.swing.JTextField;
-import javax.vecmath.Vector3f;
-
-import tesseract.World;
-
-/**
- * Abstract class for menu items.
- * USE MENU ITEM IN tesseract.newmenu CLASS.
- * @author Jesse Morgan, Steve Bradshaw
- * @deprecated by Phillip Cardon
- */
-public abstract class TesseractMenuItem
- extends JMenuItem implements ActionListener {
-
- /**
- * Serial ID.
- */
- private static final long serialVersionUID = 1839955501629795920L;
-
- /**
- * A Default radius.
- */
- private static final float DEFAULT_RADIUS = 0.1f;
-
- /**
- * A Default position.
- */
- private static final Vector3f DEFAULT_POSITION = new Vector3f(0, 0, 0);
-
- /**
- * The reference to the world.
- */
- protected World myWorld;
-
- /**
- * The default button
- */
- private JCheckBox my_default_button;
-
- /**
- * A Parameter setting JFrame
- */
- private JFrame my_param_frame;
-
- /**
- * A position.
- */
- private Vector3f my_position;
-
- /**
- * A radius field.
- */
- private float my_radius;
-
- /**
- * A mass field.
- */
- private float my_mass;
-
- /**
- * A position input.
- */
- private JTextField my_position_input;
-
- /**
- * A radius input.
- */
- private JTextField my_radius_input;
-
- /**
- * A mass input.
- */
- private JTextField my_mass_input;
-
- /**
- * The button that get all inputs for shape
- */
- private JButton my_enter_button;
-
- /**
- * Constructor.
- *
- * @param theWorld The world in which to add.
- * @param theLabel The label for the menu item.
- */
- public TesseractMenuItem(final World theWorld, final String theLabel) {
- super(theLabel);
-
- myWorld = theWorld;
-
- my_position = new Vector3f(0,0,0);
- my_radius = 0f;
- my_mass = 1;
-
- addActionListener(this);
- }
-
- /**
- * Utility method to parse a string formatted as x,y,z into a vector3f.
- *
- * @param input A string to parse.
- * @return A vector3f.
- */
- protected Vector3f parseVector(final String input) {
- String[] split = input.split(",");
-
- float x = Float.parseFloat(split[0]);
- float y = Float.parseFloat(split[1]);
- float z = Float.parseFloat(split[2]);
-
- return new Vector3f(x, y, z);
- }
-
- protected void createParameterMenu() {
-
- my_param_frame = new JFrame("Parameters");
- my_param_frame.setBackground(Color.GRAY);
- my_param_frame.setLayout(new GridLayout(5,2));
-
- Toolkit tk = Toolkit.getDefaultToolkit();
- Dimension screenSize = tk.getScreenSize();
- int screenHeight = screenSize.height;
- int screenWidth = screenSize.width;
- my_param_frame.setSize(screenWidth / 4, screenHeight / 4);
- my_param_frame.setLocation(screenWidth / 4, screenHeight / 4);
-
- my_position_input = new JTextField(10);
- my_position_input.setText("0,0,0");
- my_radius_input = new JTextField(10);
- my_radius_input.setText(".1");
- my_mass_input = new JTextField(10);
- my_mass_input.setText("1");
-
- JLabel blank = new JLabel("");
- JLabel position_label = new JLabel("Enter Position: ");
- JLabel radius_label = new JLabel("Enter Radius: ");
- JLabel mass_label = new JLabel("Enter Mass: ");
-
- my_enter_button = new JButton("ENTER");
-
- my_default_button = new JCheckBox("Default Shape ");
-
- my_param_frame.add(my_default_button);
- my_param_frame.add(blank);
- my_param_frame.add(position_label);
- my_param_frame.add(my_position_input);
- my_param_frame.add(radius_label);
- my_param_frame.add(my_radius_input);
- my_param_frame.add(mass_label);
- my_param_frame.add(my_mass_input);
- my_param_frame.add(my_enter_button);
-
- my_param_frame.setAlwaysOnTop(true);
- my_param_frame.pack();
- my_param_frame.setVisible(isVisible());
- }
-
- protected JCheckBox getDefaultButton() {
- return my_default_button;
- }
-
- protected JFrame getParamFrame() {
- return my_param_frame;
- }
-
- protected JButton getEnterButton() {
- return my_enter_button;
- }
-
- /**
- * @return the defaultRadius
- */
- public static float getDefaultRadius() {
- return DEFAULT_RADIUS;
- }
-
- /**
- * @return the defaultPosition
- */
- public static Vector3f getDefaultPosition() {
- return DEFAULT_POSITION;
- }
-
- /**
- * @return the input position.
- */
- public Vector3f getPosition() {
- return my_position;
- }
-
- /**
- * @return the radius.
- */
- public float getRadius() {
- return my_radius;
- }
-
- /**
- * @return the mass.
- */
- public float getMass() {
- return my_mass;
- }
-
- /**
- *
- * @param the_position the new position
- */
- public void setPosition(final Vector3f the_position) {
- my_position = the_position;
- }
-
- /**
- * @param the_radius float sets the radius.
- */
- public void setRadius(final float the_radius) {
- my_radius = the_radius;
- }
-
- /**
- * @param the_mass float sets the mass.
- */
- public void setMass(final float the_mass) {
- my_mass = the_mass;
- }
-
- /**
- * @return the input position input
- */
- public JTextField getPositionField() {
- return my_position_input;
- }
-
- /**
- * @return the radius input.
- */
- public JTextField getRadiusField() {
- return my_radius_input;
- }
-
- /**
- * @return the mass input.
- */
- public JTextField getMassField() {
- return my_mass_input;
- }
-}