1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
   | class DrawPanel extends Panel{     private static final long serialVersionUID = 1L;     public DrawPanel() {         super();     }     @Override     public void paint(Graphics g) {                  super.paint(g);         Color bg = Color.WHITE;         Color fg = Color.RED;                  g.setColor(bg);         g.draw3DRect(50, 50, 699, 140, true);         g.draw3DRect(53, 53, 692, 133, true);                  g.setColor(fg);                  g.drawLine(60, 60, 140, 60);                  g.drawRect(150, 60, 80, 50);                  g.drawRoundRect(240, 60, 80, 50, 25, 25);                  g.drawOval(330, 60, 80, 50);                  g.drawArc(420, 60, 50, 50, 0, 90);                  Polygon polygon = new Polygon();         polygon.addPoint(510, 60);         polygon.addPoint(550, 60);         polygon.addPoint(550, 110);         polygon.addPoint(590, 110);         g.drawPolygon(polygon);                  g.fillRect(600, 60, 80, 50);                  g.fill3DRect(60, 120, 80, 50, true);                  g.fillRoundRect(150, 120, 80, 50, 25, 25);                  g.fillOval(240, 120, 80, 50);                  g.fillArc(330, 120, 50, 50, 0, 90);                  Polygon polygon2 = new Polygon();         polygon2.addPoint(390, 120);         polygon2.addPoint(440, 120);         polygon2.addPoint(440, 180);         polygon2.addPoint(490, 180);         g.fillPolygon(polygon2);                  g.drawString("finish draw test!", 500, 150);     } }
  |