// file: testApplet1.java // author: Robert Keller // purpose: Applet showing use of Graphics class for simple unanimated graphics import java.applet.*; import java.awt.*; // to get awt (abstract window toolkit) public class testApplet1 extends Applet // consider this to be magic for now { // paint(Graphics) will be called by the system to paint the Frame when // necessary. At that time, the Graphics of the frame will be passed as // an argument. public void paint(Graphics g) { g.setColor(Color.black); // set the color for drawing g.drawRect(50, 50, 400, 300); // draw a rectangle g.setColor(Color.blue); g.fillOval(100, 100, 300, 200); // fill an oval g.setFont(new Font("Times", Font.BOLD, 28)); g.setColor(Color.yellow); g.drawString("Harvey Mudd College", 140, 210); // draw a string } public void init() { setBackground(Color.white); } }