Why different font rendering with graphics.drawString() and a default JLabel with ClearType?

Why has the displayed GUI different font style/rendering with graphics.drawString() and a default JLabel with activated cleartype? And how can i fix it?

Answers


Try this

Graphics2D g2d = (Graphics2D)g;    
Font font = new Font("Arial", Font.PLAIN, 12);

g2d.setFont(font);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawString("Hello World", 25, 100);

Need Your Help

Send HTTP GET request with header

java android http http-headers

From my Android app I want to request a URL with GET parameters and read the response.

ELMAH applicationName: show exceptions logged by another site

asp.net-mvc-3 iis-7 elmah

I have one site logging errors using Elmah.SqlErrorLog. My goal to have another site contain the handlers that serve the pages one would typically see at localhost/elmah.axd. The reason for this is...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.