summaryrefslogtreecommitdiff
path: root/src/tesseract/newmenu/NewIcosahedronMenuItem.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/tesseract/newmenu/NewIcosahedronMenuItem.java')
-rw-r--r--src/tesseract/newmenu/NewIcosahedronMenuItem.java37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/tesseract/newmenu/NewIcosahedronMenuItem.java b/src/tesseract/newmenu/NewIcosahedronMenuItem.java
index 910b834..4123486 100644
--- a/src/tesseract/newmenu/NewIcosahedronMenuItem.java
+++ b/src/tesseract/newmenu/NewIcosahedronMenuItem.java
@@ -2,10 +2,6 @@ package tesseract.newmenu;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
import java.util.Set;
import javax.swing.JButton;
@@ -25,30 +21,42 @@ import tesseract.objects.Icosahedron;
* @author Phillip Cardon
*/
public class NewIcosahedronMenuItem extends MenuItem {
- private static final float DEFAULT_MASS = 2f;
+
+ /**
+ *
+ */
private static final long serialVersionUID = 1936364496102891064L;
//private static Map <String, Object> myParams;
-
- public NewIcosahedronMenuItem (World theWorld) {
+ /**
+ * Constructor.
+ * @param theWorld to add objects to.
+ */
+ public NewIcosahedronMenuItem(final World theWorld) {
super(theWorld, "Icosahedron(NEW)");
buildParams();
- this.makePanel();
+
}
+ /**
+ * Adds Parameters for user input.
+ * Sets default text box text.
+ */
private void buildParams() {
myParameters.put("Scale", new Float(0f));
-
+ this.makePanel();
+ myReadData.get("Scale").setText(((Float)
+ Icosahedron.DEFAULT_SCALE).toString());
}
@Override
- public void actionPerformed(ActionEvent e) {
+ public void actionPerformed(final ActionEvent e) {
createParameterMenu();
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()) {
@@ -72,7 +80,8 @@ public class NewIcosahedronMenuItem extends MenuItem {
}
if (event.getSource() == enterButton) {
- myWorld.addObject(new Icosahedron(getPosition(), getMass(), getScale()));
+ myWorld.addObject(new Icosahedron(
+ getPosition(), getMass(), getScale()));
params.dispose();
}
}
@@ -80,6 +89,10 @@ public class NewIcosahedronMenuItem extends MenuItem {
}
+ /**
+ * Gets the Scale for Icosahedron.
+ * @return the scale.
+ */
private float getScale() {
return ((Float) myParameters.get("Scale")).floatValue();
}