From 3b2aa407ba194f4a44536ac141fe5fbd2a67ad7c Mon Sep 17 00:00:00 2001 From: Steve Date: Fri, 11 Feb 2011 05:57:56 +0000 Subject: added iso to menu --- src/tesseract/menuitems/IcosahedronMenuItem.java | 51 ++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/tesseract/menuitems/IcosahedronMenuItem.java (limited to 'src/tesseract/menuitems/IcosahedronMenuItem.java') diff --git a/src/tesseract/menuitems/IcosahedronMenuItem.java b/src/tesseract/menuitems/IcosahedronMenuItem.java new file mode 100644 index 0000000..554e42b --- /dev/null +++ b/src/tesseract/menuitems/IcosahedronMenuItem.java @@ -0,0 +1,51 @@ +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.Icosahedron; +import tesseract.objects.PlanarPolygon; + +/** + * Planar Polygon Menu Item. + * + * @author Steve Bradshaw + */ +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) { + //Color c = JColorChooser.showDialog(null, "Planar Polygon Color", Color.RED); + Vector3f pos = + parseVector(JOptionPane.showInputDialog("Enter the position")); + float radius = + Float.parseFloat(JOptionPane.showInputDialog("Enter the radius")); + + myWorld.addObject(new Icosahedron(pos, radius)); + } +} + -- cgit v1.2.3