Reputation: 309
How to make Graphics.drawString()
get exactly the same font as that of JLabel
?
I've tried all the fonts I could find in UIManager.getDefaults()
but even if I use the followings to make the String that drawString() not that thin as before.
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
It still looks a little bit different.
Upvotes: 4
Views: 1141
Reputation: 347204
UIManager.getFont("Label.font")
should work under most look & feels
Upvotes: 4