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