Improved Test Code
authorBill Kuker <bkuker@billkuker.com>
Sun, 31 Oct 2010 13:37:58 +0000 (13:37 +0000)
committerBill Kuker <bkuker@billkuker.com>
Sun, 31 Oct 2010 13:37:58 +0000 (13:37 +0000)
src/com/billkuker/rocketry/motorsim/GraphSimplifier.java

index b9dde99a0bebca9132e71e67bea25ef1c77e2cb1..6f3a823aac5d8e344bbed7a359b5e543f5ce7861 100644 (file)
@@ -15,6 +15,8 @@ import javax.measure.quantity.Area;
 import javax.measure.quantity.Length;
 import javax.measure.quantity.Quantity;
 import javax.measure.unit.SI;
+import javax.swing.JFrame;
+import javax.swing.JSplitPane;
 
 import org.jscience.physics.amount.Amount;
 
@@ -108,12 +110,18 @@ public class GraphSimplifier<X extends Quantity, Y extends Quantity> {
                g.setLength(Amount.valueOf(70, SI.MILLIMETER));
                g.setOD(Amount.valueOf(30, SI.MILLIMETER));
                g.setID(Amount.valueOf(10, SI.MILLIMETER));
+               
+               JFrame f = new JFrame();
+               f.setSize(1024, 768);
+               f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+               JSplitPane jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
+               f.add(jsp);
 
                Chart<Length, Area> c = new Chart<Length, Area>(SI.MILLIMETER,
                                SI.MILLIMETER.pow(2).asType(Area.class), g, "surfaceArea");
                c.setDomain(c.new IntervalDomain(Amount.valueOf(0, SI.CENTIMETER), g
                                .webThickness()));
-               c.show();
+               jsp.setTopComponent(c);
 
                GraphSimplifier<Length, Area> gs = new GraphSimplifier(g,
                                "surfaceArea", c.new IntervalDomain(Amount.valueOf(0,
@@ -122,6 +130,10 @@ public class GraphSimplifier<X extends Quantity, Y extends Quantity> {
                Chart<Length, Area> d = new Chart<Length, Area>(SI.MILLIMETER,
                                SI.MILLIMETER.pow(2).asType(Area.class), gs, "value");
                d.setDomain(gs.getDomain());
-               d.show();
+               jsp.setBottomComponent(d);
+               
+               f.setVisible(true);
+               jsp.setDividerLocation(.5);
+               jsp.revalidate();
        }
 }