//File: Play.java import java.applet.*; import java.awt.*; public class Play extends Applet { //The paint() method is called by the browser whenever the applet must be redrawn public void paint (Graphics g) { //In the following comments, I'll use the convention that //x1, y1, x2, y2 are the x and y coordinates of //points 1 and 2 respectively g.setColor (Color.blue); g.drawLine (30, 60, 60, 30); //(x1, y1, x2, y2) //In the following, all of the figures are based on a //rectangle defined by the x and y coordinates of the //top left corner and the width and height of the rectangle g.drawRect (90, 30, 40, 30); //(x, y, width, height) g.fillRect (150, 30, 50, 30); //(x, y, width, height) g.drawOval (220, 30, 70, 30); //(x, y, width, height) //NOTE: You can create your own colors as follows: Color yourColor = new Color (200, 100, 250); g.setColor (yourColor); //g.setColor (Color.red); g.fillOval (30, 80, 70, 30); //(x, y, width, height) g.fillArc (110, 80, 40, 30, 45, 315); //(x, y, width, height, starting angle, sweep angle) g.drawRoundRect(170, 80, 60, 30, 30, 10); //(x, y, width, height, xpixels, ypixels) //where xpixels and ypixels are the number //of pixels in from the corners where rounding //begins to occur g.fillRoundRect (250, 80, 50, 30, 20, 20); //(x, y, width, height, xpixels, ypixels) } }