Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set RenderingHints globally?

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.

like image 288
javacavaj Avatar asked Apr 22 '09 20:04

javacavaj


1 Answers

There's a system property for that.

like image 199
Michael Borgwardt Avatar answered Oct 06 '22 01:10

Michael Borgwardt