JDK-6640346 : Nimbus JInternalFrame setFrameIcon causes messed up title bar
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u10
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-12-11
  • Updated: 2011-02-16
  • Resolved: 2007-12-14
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_10-ea"
Java(TM) SE Runtime Environment (build 1.6.0_10-ea-b08)
Java HotSpot(TM) Client VM (build 1.6.0_10-ea-b08, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Windows XP SP 2.

EXTRA RELEVANT SYSTEM CONFIGURATION :
Nothing special

A DESCRIPTION OF THE PROBLEM :
I just got the Update N thing with the Nimbus look and feel.

I have a JDesktopPane with a JInternalFrame.

Calling setFrameIcon on the internal frame, with a 16x16 icon will cause a major glitch to the title bar. The left-most button in the title bar (which causes a drop down menu with Close, Resize, etc.) seems to become too large for the title bar because it now contains the icon.

Here's a screenshot:

http://img412.imageshack.us/img412/6973/nimbusbugsn2.png

The icon is a pretty normal 16x16 png image.



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
call setFrameIcon with a 16x16 icon for a JInternalFrame contained in a JDesktopPane.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Title bar should look normal.
ACTUAL -
Title bar is totally messed up:

http://img412.imageshack.us/img412/6973/nimbusbugsn2.png

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.ImageIcon;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class NimbusBug {

  public static void main(String[] args) {

    try {

      UIManager.setLookAndFeel("sun.swing.plaf.nimbus.NimbusLookAndFeel");

    } catch (ClassNotFoundException e) {
    } catch (InstantiationException e) {
    } catch (IllegalAccessException e) {
    } catch (UnsupportedLookAndFeelException e) {
    }

    JFrame frame = new JFrame("Nimbus bug");
    frame.setSize(640, 480);
    
    JDesktopPane desktopPane = new JDesktopPane();
    frame.add(desktopPane);
    
    JInternalFrame internalFrame = new JInternalFrame("This is a title");
    internalFrame.setSize(320, 200);
    internalFrame.setFrameIcon(new ImageIcon("d:\\16x16.png"));
    internalFrame.setVisible(true);
    
    desktopPane.add(internalFrame);
    
    frame.setVisible(true);
  }
}

---------- END SOURCE ----------