// Antialiasing fonts in JDK 1.2 to get rid of the jaggies.
// Override the paint method of the Component you want to anti-alias.

public void paint ( graphics g )
   {
   if ( g instanceof Graphics2D )
      {
      Graphics2D g2d = (Graphics2D)g;

      // for antialising geometric shapes
      g2d.addRenderingHints( new RenderingHints( RenderingHints.KEY_ANTIALIASING,
                                                 RenderingHints.VALUE_ANTIALIAS_ON ));
      // for antialiasing text
      g2d.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING,
                            RenderingHints.VALUE_TEXT_ANTIALIAS_ON );

      g = g2d;
      }
   super.paint( g );
   }