Question

I remember, not too long ago, somebody post a link on how to specify the global rendering hints to use anti-alias in java.

Unfortunately I can't find the question.

How can I specify the rendering hint to use anti-alias in swing?

Was it helpful?

Solution

For a single Graphics2D:

Graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, 
             RenderingHints.VALUE_ANTIALIAS_ON);

Call that on the Graphics2D you are drawing on, and you will have anti-aliasing!!

For global settings:

//this SHOULD enable global anti-aliasing
System.setProperty("awt.useSystemAAFontSettings","on");
System.setProperty("swing.aatext", "true");

EDIT By oreyes:

The first one did it!!!

alt text http://img35.imageshack.us/img35/4421/imagen1urb.png

vs.

alt text http://img169.imageshack.us/img169/4089/imagen2i.png

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top