JDK-6240616 : REGRESSION: Internal Frame window icons distorted in JDK1.5 using Windows XP
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0,6
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-03-15
  • Updated: 2011-02-16
  • Resolved: 2007-08-08
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
C:\WINDOWS\system32>java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
We found the following issue starting in Java 1.5 with Windows XP, which affects our product quite a bit.

If you run on Windows XP with the windows look and feel, but with the property
-Dswing.noxp=true to disable the XP look and feel (we want a uniform look accross all windows platforms), the icons for the internal frame (MDI) are bigger than normal, looking pretty bad (minimize/Maximize/Restore).

The problem is easy to reproduce with the SwingSet2 example provided by Sun with JDK1.5.

Simply run the demo with the property to disable XP look and feel

java -Dswing.noxp=true -jar SwingSet2.jar

And set the look and feel to windows. Now look at the icons for the internal frames. They are way bigger (and ugly) than normal. (only on XP OS)

This issue was introduced in Java 1.5 (did not happen in 1.4.2).


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
The problem is easy to reproduce with the SwingSet2 example provided by Sun with JDK1.5.

Simply run the demo with the property to disable XP look and feel

java -Dswing.noxp=true -jar SwingSet2.jar

And set the look and feel to windows. Now look at the icons for the internal frames. They are way bigger (and ugly) than normal. (only on XP OS)


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The icons for the internal frame should be the normal size, as displayed on other Windows OS (2000, NT, etc.)
ACTUAL -
The icons are larger than usual, not looking very good.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Use the SwingSet2 example provided with JDK 1.5:

java -Dswing.noxp=true -jar SwingSet2.jar
---------- END SOURCE ----------

Release Regression From : 1.4.2_07
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.
###@###.### 2005-03-15 05:29:58 GMT

Comments
EVALUATION I'm re-closing this bug. The purpose of the WindowsLookAndFeel is and always has been to enable Java programs to blend in with native applications on Windows platforms. To this end, when running on Windows XP, WindowsLookAndFeel matches the underlying theme selected by the user, be it XP, Classic, etc. But to want a Java app to look like Classic when the rest of the system looks like XP is a very special case (as evidenced by the fact that this bug has 0 votes), and in any other situation would be considered a serious bug. Even so, we have provided a way to do this, via the swing.noxp property. If your application uses internal frames, you can use the Workaround to improve the "Classic" look; it's less than 10 lines. But I'm afraid that at this time, we cannot commit additional engineering resources to providing a perfect solution within the JRE for such an edge case.
08-08-2007

EVALUATION I am reopening this bug because it is a behavior we should support, even if it is not recommended.
12-09-2006

WORK AROUND You can recreate the original Classic look (assuming it was unthemed) by turning on the swing.noxp property and setting the following UI properties. Hardcoding these values will approximate the Windows Classic internal frame window buttons. You must set these values after the Windows Look and Feel has been set and before your components have been created on screen. The example main method below will set the properties and then call the SwingSet2 demo app. public static void main(String[] args) throws Exception { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.put("InternalFrame.titlePaneHeight",new Integer(18)); UIManager.put("InternalFrame.titleButtonWidth",new Integer(18)); UIManager.put("InternalFrame.titleButtonHeight",new Integer(18)); UIManager.put("InternalFrame.titleFont",new Font("Tahoma",Font.BOLD,11)); SwingSet2.main(args); }
08-08-2005

EVALUATION This bug only applies when using the XP theme on Windows XP and when the swing.noxp property has been set to true. Setting the swing.noxp property is equivalent to using the WindowsClassicLookAndFeel when the standard XP theme is active. In J2SE 1.4 Swing drew the Windows components by hand so it could default back to the pre-XP behavior when desired. In J2SE 1.5 and beyond we get the drawing information (component images, sizes, etc) directly from the operating system so that we can more accurately render components. This means Swing does not have any drawing information available about the classic look unless the user is currently running the classic themeset in XP (set from the Display Control Panel), and therefore we cannot accurately draw classic components in this environment. It is possible to hard code certain values when the swing.noxp property is set to fix this particular bug. However, hard coded values are not a general purpose solution and will not work if we are trying to emulate a particular version of classic. Because of this we have decided not to fix the bug but will instead provide some workaround defaults the application developer can use. It should be stressed that using swing.noxp is a bad idea. If the user has the XP theme set in their operating system then the Swing application should match that. If the user has the classic theme set then the app should match that as well. Swing will already do this. The only time the swing.noxp is useful is when the application author intentionally wishes the application to look out of place (classic L&F while running on the XP theme); which is, in general, a bad idea. In the case where the author wishes to have a consistent look and feel across multiple revisions of the operating system the author should consider using a custom L&F or Metal, which was designed for this purpose.
08-08-2005