// GraphicsTest.java import java.awt.*; import java.applet.*; public class GraphicsTest extends Applet { public void init() { } public void paint(Graphics g) { Rectangle r = bounds(); g.setColor(Color.white); g.fillRect(r.x, r.y, r.width, r.height); g.setColor(Color.black); g.drawOval(10, 10, 50, 50); g.fillOval(70, 10, 50, 50); g.drawArc(130, 10, 50, 50, -90, 270); g.fillArc(190, 10, 50, 50, -90, 270); g.drawRect(10, 70, 50, 50); g.fillRect(70, 70, 50, 50); g.drawRoundRect(130, 70, 50, 50, 10, 10); g.fillRoundRect(190, 70, 50, 50, 10, 10); Polygon thePoly = new Polygon(); thePoly.addPoint(10, 130); thePoly.addPoint(70, 150); thePoly.addPoint(120, 130); thePoly.addPoint(120, 180); thePoly.addPoint(70, 170); thePoly.addPoint(10, 180); thePoly.addPoint(10, 130); g.drawPolygon(thePoly); thePoly = new Polygon(); thePoly.addPoint(130, 130); thePoly.addPoint(190, 150); thePoly.addPoint(240, 130); thePoly.addPoint(240, 180); thePoly.addPoint(190, 170); thePoly.addPoint(130, 180); thePoly.addPoint(130, 130); g.fillPolygon(thePoly); g.setColor(Color.gray); g.draw3DRect(10, 190, 50, 50, true); g.fill3DRect(70, 190, 50, 50, true); g.draw3DRect(130, 190, 50, 50, false); g.fill3DRect(190, 190, 50, 50, false); } }