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?
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);
精彩评论