From 1a68dca420fc432b2267ef786c040759d2ca50e2 Mon Sep 17 00:00:00 2001 From: Phillip Date: Sun, 20 Feb 2011 21:53:53 +0000 Subject: Spelling corrections, added NewToroidMenuItem --- src/tesseract/newmenu/NewIcosahedronMenuItem.java | 37 +++++++++++++++-------- 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'src/tesseract/newmenu/NewIcosahedronMenuItem.java') 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 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(); } -- cgit v1.2.3