Search code examples
javaswinglook-and-feel

JInternalFrame cropped Look and feel on windows


I'm currently working on a stand-alone java application running on Windows 7 with Aero.

I'm trying to use the system look and feel but I got some trouble with the look of the JInternalFrame.

http://img11.hostingpics.net/pics/300466buginternalframe.png

This is a screenshot of the internalFrame demo from Oracle

As you can see, I use the system look-and-feel, but the lower border is cropped and the title buttons are too close of the right side of the window. Those also seems to be a bit cropped.

I search for a fix to those issues but the only advice I found is to reduce the buttons width by changing the UIManager properties:

 UIManager.put("InternalFrame.titleButtonWidth", 10);

This line do reduce the buttons but they still seems to be cropped. And it does not fix the lower border issue.

How could I possibly fix these 2 issues using the system look-and-feel?


Solution

  • The only way I found to bypass this bug is to change the internalFrame close icon for a custom icon in the UIManger which is a bit smaller than the original close icon:

    ImageIcon closeIcon = new ImageIcon(ImageIO.read(new File(iconPath)))
    UIManager.put("InternalFrame.closeIcon", closeIcon);