Welcome to Computer Programming


Basic drawing activity


You are going to write the code in paint to draw a scene. It is like Alice or AppLab but you will be writing code.  So the precedure or commands to have it do something is in a huge library called graphics. Look at the api here - on this page go to methods. You will see hundreds like drawLine or fillOval).   To use them you will say g.drawLine(30,30,200,200); this will draw a line from an x and y of (30,30) to an x and y of (200,200);

I want you to create a drawing that looks like something (a person, a house), I want at least 3 colors and shapes. I also want you to draw some text on it.

import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;

public class Drawing extends JFrame{

    public void paint(Graphics g) {
        g.fillRect(0, 0, 200, 100);
        g.drawString("Sample Drawing", 20, 20);
        g.drawString("created by Borland", 200, 400);

    public Drawing(){
        JPanel panel=new JPanel();


    public static void startDrawing(){
        Drawing d=new Drawing();