开发者

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

开发者 https://www.devze.com 2023-03-14 17:10 出处:网络
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?

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?

开发者_开发百科

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


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);
0

精彩评论

暂无评论...
验证码 换一张
取 消