// Calculate Pi by the Monte Carlo method. Draws the random point area // Works in a frame import java.awt.*; import javax.swing.*; public class PiFrame { public static void main (String[] args) { JFrame frame = new JFrame ("Calculate Pi"); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); PiSquare square = new PiSquare(); frame.getContentPane().add(square); frame.pack(); // sets the frame size to fit its content frame.setVisible(true); } }