// Antialiasing fonts in JDK 1.3 to get rid of the jaggies.
// Override the paintComponent method of the JComponent you
// want to anti-alias.

/**
 * called whenever system has a slice to render
 *
 * @param g
 *        Graphics defining where and region to paint.
 */
protected void paintComponent ( Graphics g )
   {
   Graphics2D g2d = (Graphics2D)g;
   if ( antialias )
      {

      // for antialiasing geometric shapes
      g2d.setRenderingHint( RenderingHints.KEY_ANTIALIASING,
                            RenderingHints.VALUE_ANTIALIAS_ON );

      // for antialiasing text
      g2d.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING,
                            RenderingHints.VALUE_TEXT_ANTIALIAS_ON );

      // to go for quality over speed
      g2d.setRenderingHint( RenderingHints.KEY_RENDERING,
                            RenderingHints.VALUE_RENDER_QUALITY );
      }
   super.paintComponent( g2d );
   }