Enable desktop font rendering hints in JTabbedPaneSmartIcon

16 views
Skip to first unread message

Andrius Šabanas

unread,
Oct 23, 2009, 10:09:16 AM10/23/09
to vldocking
Hi all,

It would be nice to enable desktop rendering hints when custom-
painting icon for JTabbedPaneSmartIcon, so that rendered fonts use
subpixel antialiasing under Java 1.6, just like in standard Swing
widgets.

This is the code snippet that need to be added to the top of paintIcon
(...) method (I have also attached a patch to "Files" section for this
Google group):

---------------- starts here ----------------
// set default desktop font rendering hints
Object desktopHintsObject = Toolkit.getDefaultToolkit
().getDesktopProperty("awt.font.desktophints");
if (desktopHintsObject instanceof Map) {
g2.addRenderingHints((Map<?, ?>) desktopHintsObject);
}
---------------- end here ----------------


cheers,

Andrius
Reply all
Reply to author
Forward
0 new messages