6

For a Java application, can I set the RenderingHints on a global basis? Currently, I've defined these in the paintComponent method as shown below. I would prefer, however, to set them once when the application starts and have them persist throughout the session.

@Override
protected void paintComponent(Graphics g)
{
super.paintComponent(g);

Graphics2D g2d = (Graphics2D) g;
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
}

Thanks.

Michael Myers
  • 188,989
  • 46
  • 291
  • 292
javacavaj
  • 2,901
  • 5
  • 39
  • 66

1 Answers1

1

There's a system property for that.

Michael Borgwardt
  • 342,105
  • 78
  • 482
  • 720