/*
 * This program opens a window on the screen that shows a very
 * simple drawing.  The paintComponent() subroutine can be changed
 * to make the program draw a different picture.
 */
 
import java.awt.*;
import javax.swing.*;
 
public class Picture extends JPanel {
 
   public static void main(String[] args) {
      JFrame frame = new JFrame("My First Java Drawing");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      Picture picture = new Picture();
      picture.setPreferredSize(new Dimension(500,500));
      frame.setContentPane(picture);
      frame.pack();
      frame.setResizable(false);
      frame.setLocation(50,50);
      frame.setVisible(true);
   }
   
   public void paintComponent(Graphics g) {
      g.setColor(Color.BLACK);
      g.fillRect(0,0,500,500);
      g.setColor(Color.RED);
      g.fillRect(100,100,300,300);
      g.setColor(Color.WHITE);
      g.fillRect(200,200,100,100);
   }
 
}
 
