1 import javax.swing.JFrame;
2
3 public class RectangleViewer
4 {
5 public static void main(String[] args)
6 {
7 JFrame frame = new JFrame();
8
9 frame.setSize(300, 400);
10 frame.setTitle("Two rectangles");
11 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
12
13 RectangleComponent component = new RectangleComponent();
14 frame.add(component);
15
16 frame.setVisible(true);
17 }
18 }