import java.applet.Applet; import java.awt.Color; import java.awt.Graphics; /** * Draw a bordered square on the screen. May have some errors * (which students will repair in the laboratory session). * * @author Samuel A. Rebelsky * @version 1.0 of March 1998 */ public class BorderedSquareApplet extends Applet { /** * Paint a black square with a red border. */ public void paint(Graphics paintBrush) { // Set the background to white to make gaps more obvious. setBackground(Color.white); // Paint the main body. paintBrush.setColor(Color.black); paintBrush.fillRect(5,5,40,40); // Attempt to paint the border. paintBrush.setColor(Color.red); paintBrush.drawRect(4,4,42,42); } // paint(Graphics) } // class BorderedSquareApplet