diff options
author | Phillip <pacardon@u.washington.edu> | 2011-02-20 21:53:53 +0000 |
---|---|---|
committer | Phillip <pacardon@u.washington.edu> | 2011-02-20 21:53:53 +0000 |
commit | 1a68dca420fc432b2267ef786c040759d2ca50e2 (patch) | |
tree | 467a3d4e8936f732e4cc0fc6563d79848d409001 /src/tesseract/newmenu/NewIcosahedronMenuItem.java | |
parent | 5d737c42197d7f7c0e4d7a088bd99141481b5145 (diff) |
Spelling corrections, added NewToroidMenuItem
Diffstat (limited to 'src/tesseract/newmenu/NewIcosahedronMenuItem.java')
-rw-r--r-- | src/tesseract/newmenu/NewIcosahedronMenuItem.java | 37 |
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();
}
|