OscarRyz
OscarRyz

Reputation: 199284

Specify antialias property in the command line

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?

Upvotes: 4

Views: 1625

Answers (1)

jjnguy
jjnguy

Reputation: 138932

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

Upvotes: 5

Related Questions