JavaApplet: Draw Rectangles

 

 

Here is the Rectangles.java source code

import java.applet.Applet;
import java.awt.*;

public class Rectangles extends Applet {

            public void init () {
                  setBackground (Color.green);            
            }

            public void paint (Graphics g) {
                  g.setColor (Color.black);

                  // location x, location y, width x, height y
                  g.drawRect (10, 20, 100, 50);
                  g.fillRect (10, 100, 100, 50);

                  //round: int x, int y, int width, int height, int arcWidth, int arcHeight
                  g.drawRoundRect (10, 170, 100, 50, 20, 20);
            }
}