import java.awt.*; import javax.swing.*; import java.util.*; import java.text.*; public class TestRectangle2DGUI { private JFrame outputFrame; private Container container; private Rectangle2DDrawingPanel rectangle2DsDrawingPanel; public static void main(String[] args) { new TestRectangle2DGUI(); } public TestRectangle2DGUI() { //stuff to make a frame and drawing panel: outputFrame = new JFrame(); outputFrame.setSize(1000,700); outputFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); rectangle2DsDrawingPanel = new Rectangle2DDrawingPanel(); rectangle2DsDrawingPanel.setBackground(Color.WHITE); outputFrame.getContentPane().add( rectangle2DsDrawingPanel); outputFrame.setVisible(true); int N, points; DecimalFormat d2 = new DecimalFormat ("0.00"); String input = JOptionPane.showInputDialog( "Enter number of rectangles", "100" ); N = Integer.parseInt( input ); input = JOptionPane.showInputDialog( "Enter number of points", "100" ); points = Integer.parseInt( input ); Rectangle2D [] cA = new Rectangle2D[N]; //array of Rectangle2D references cA[0] = new Rectangle2D(); //unit rectangle cA[1] = new Rectangle2D(0,0, 20,20); //20x20 at origin cA[2] = new Rectangle2D(50,50, 30,60); //30x60 at (50,50) cA[3] = new Rectangle2D(150,250, 50,10); //50x10 at (150,250) cA[4] = new Rectangle2D(110,60, 200,100); //200x100 at (110,60) for (int i=5; i