JDK-6424528 : Wrong mapping of color happens if one takes print of a swing component in 16 bit color depth
  • Type: Bug
  • Status: Resolved
  • Resolution: Fixed
  • Component: client-libs
  • Sub-Component: 2d
  • Priority: P3
  • Affected Version: 1.4.0,1.4.2,1.4.2_05,1.4.2_10,6
  • OS: generic,linux,windows_nt,windows_2000,windows_xp
  • CPU: generic,x86
  • Submit Date: 2006-05-11
  • Updated Date: 2010-12-09
  • Resolved Date: 2006-06-26
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 Availabitlity Release.

To download the current JDK release, click here.
Other
1.4.2_13 b01Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
There is an issue in 1.4.2_10 that if one takes the printout of the Swing component with color depth of 16 bit, incorrect mapping of color happens in the printout.  This issue happens on Windows 2000 / XP platform.

Please refer attached GUI testcase and try to take printout.  Please make sure to change screen to 16 bit at Desktop -> Properties -> Settings (TAB) -> Colors and apply it before taking printout.

Please note that this is generic Java 2D issue and has nothing to with kind of printer used.

Comments
SUGGESTED FIX AffineTransform is used to scale and tranform buffered image to printer context. Fix is to getting around the problem by rounding the co-ordinates close to an integral to avoid fp error which then results in selecting optimal image transform pipe.
2006-05-11

WORK AROUND Swing component by default uses double buffering and that ends up running into this issue. Switching off double buffering can work around this issue. Double buffering can be disabled by use of javax.swing.RepaintManager.setDoubleBufferingEnabled(false) before making a call to Component.paint(Graphics) in print method. 54a55,56 > RepaintManager rm = RepaintManager.currentManager(panel); > rm.setDoubleBufferingEnabled(false); 55a58 > rm.setDoubleBufferingEnabled(true);
2006-05-11

EVALUATION This is a known issue with Swing and that's due to Java2D issue described in CR 4886732.
2006-05-11