JDK-6302464 : Allow programmatic enabling of subpixel anti-aliasing in Swing on ANY platform
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2005-07-27
  • Updated: 2015-11-09
  • Resolved: 2015-08-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
9 b82Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
I'm following up a forum discussion with Phil Race on java.net:

...and an article by Chet Haase on the same site:

Basically, subpixel anti-aliasing is now doable when drawing text using Java2D and the new RenderHints.  It is also automatically used to render Sun's standard look-and-feels for Swing when the host operating system is using subpixel anti-aliasing (say Windows XP with ClearType enabled).  However, despite Java2D being equally capable on other platforms, such as Windows 2000, which don't have this capability and hence an option to enable it for native applications, there's no way to force look-and-feels that are aware of this new feature to take advantage of it.

Under Windows 2000, for example, I can't programmatically force the Windows SystemLookAndFeel to use it, which is a shame, as it would enhance the polish of Swing applications and make them more readable, and be an advantage over competing desktop toolkits.  Windows 2000 is an example here, there are undoubtedly other platforms that could benefit.

It should be possible to set a UIDefault or call some method to specify:

a) that subpixel anti-aliasing should be used to render Swing components
b) which TYPE of anti-aliasing should be used (given that Java2D specifies multiple options).

Ideally, it should be possible to query some object (Font?) to find out what sort of font rendering hints the system applies, and not override them if the system natively supports it and if the user has expressed a preference, avoiding overriding user preferences.  It should also be possible to detected (from the same API) to determine if the system actual has this capability (if it doesn't, the application could offer the user an option to enable it or just switch it on).

Something like:


...to query the desktop's native subpixel (or standard) text anti-aliasing before steamrollering them with the developer's personal antialiasing preference.  Or just stick totally to the type of anti-aliasing keys/values already in the RenderingHints' classes' constants.

Thereafter, use UIDefaults with RenderingHints to suggest to look-and-feels that this feature is sought.  Older third-party look-and-feels could safely ignore it.
It's enabled or disabled internally by Swing, depending on the host machine's windowing system's preferences.  The programmer doesn't appear to have any formally specified way of controlling this.

Write your own look-and-feel...