JDK-5027331 : UIManager.getColor ("nnn") returns incorrect or null values on GTK look and feel
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2004-04-06
  • Updated: 2004-04-27
  • Resolved: 2004-04-27
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.
Other
5.0 beta2Fixed
Related Reports
Duplicate :  
Relates :  
Description
In particular this is an issue for tree cell renderers (probably table as well) - we have renderers that set their background color based on UIManager.getColor("Tree.selectionBackground").  What we get is a slightly different shade of blue than the one the tree will be painted with.

This is in general a huge problem for any third party (including us) who wants to write a custom component which will fit with the operating system, or provide custom UI delegates for a component - there simply is no way to get this information.

In Synth L&F, UIManager.getColor("control") need to return values that are pulled from the look and feel (in GTK, from the desktop theme).  If that is impossible, some API similar to SynthStyle.getColorForState() (currently a this method is private - I will try using it via reflection, but such code is fragile).

For my part, I don't particularly care if fetching colors is done via UIManager.getColor() (though this solution is the least intrusive for third party components/uis), or via some API method on GTKLookAndFeel, or better, on SynthLookAndFeel.  The main requirements are that:
 - The color returned accurately reflect the color in use by the theme at the time of the call
 - The call not require a live component to necessarily be passed in - we're talking about usage by components the look and feel won't know about.  So, something similar to getColorForState() either without the SynthContext argument, or without requiring the SynthContext's getComponent method return non null.

Since GTK look and feel supports LIGHT/MID/DARK/BLACK/WHITE keys (see GtkColorType), any solution should allow these values to be fetched, ideally via UIManager.  Should only require a simple subclass of UIDefaults.ActiveValue to implement.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta2 FIXED IN: tiger-beta2 INTEGRATED IN: tiger-beta2
14-06-2004

EVALUATION Name: omR10226 Date: 04/08/2004 We should override GTKLookAndFeel.initSystemColorDefaults and fill all system color defaults by values returned from appropriated GtkStyles. Also gtk specific colors white/light/mid/dark/black could be added to defaults. Theme changing must lead to reinitializing of defaults. Similar problem with defaults that looks like "Widget.font". ======================================================================
11-06-2004