previous | start | next

## Drawing Shapes

- paintIcon method receives graphics context of type Graphics
- Actually a Graphics2D object in modern Java versions

      public void paintIcon(Component c, Graphics g, int x, int y)
      {
       Graphics2D g2 = (Graphics2D)g;
       . . .
      }

- Can draw any object that implements Shape interface

      Shape s = . . .;
      g2.draw(s);

previous | start | next