JDK-6647340 : Minimized JInternalFrame icons appear in incorrect positions if the main frame is resized
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u3
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,windows_xp
  • CPU: other,x86
  • Submitted: 2008-01-04
  • Updated: 2020-10-14
  • Resolved: 2011-05-18
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.
JDK 7
7 b38Fixed
Related Reports
Duplicate :  
Relates :  
Description
OPERATING SYSTEM(S):
--------------------
Red Hat Linux / Windows

FULL JDK VERSION(S):
-------------------
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode)

DESCRIPTION:
------------
Steps to Recreate:

1. Launch SwingSet2.jar
2. Select JIntarnalFrame demo
3. Minimize one of the internal frames. It will become an icon located
   in the lower left corner of the main frame
4. Maximize main frame

    => Problem: Location of minimized icon in InternalFrame does not
                follow resized main frame - it is no longer at the
                bottom left of the main frame

    => Expected result: Location of icon in InternalFrame should follow
                        resized main frame and remain in the lower left
                        corner

5. Un-minimize internal frame to restore it to its original size
6. Un-maximize main frame to restore it to its original size
7. Minimize internal frame again

    => Problem: Internal frame is not minimized to the lower left of
                the main frame.

    => Expected result: Internal frame should be minimized to an icon
                        located in the lower left of the screen

Comments
WORK AROUND There is no workaround.
07-07-2008

SUGGESTED FIX Webrev: http://sa.sfbay.sun.com/projects/swing_data/7/6647340/ The idea of the fix is in the use of the same icon positioning logic for BasicInternalFrameUI and BasicDesktopIconUI. The logic was taken from BasicInternalFrameUI and put into a new separate class DesktopIconMover. This class is used from the both UIs.
07-07-2008

EVALUATION Webrev with suggested fix is in the attachment.
17-01-2008

EVALUATION The problem is in the fact that when an internal frame is iconified it is removed from JDesktopPane's children list and it unregisters its component listener. The frame is replaced by its desktop icon, which doesn't have a component listener. For the details see DefaultDesktopManager.iconifyFrame() and BasicInternalFrameUI.Handler.componentResized(). A solution can be to add a component listener to the desktop icon. The listener should implement the same logic for icon position as in BasicInternalFrameUI.Handler.componentResized(). My first idea for a fix was simply to move the icon position recalculation logic into a desktop icon component listener. However, it doesn't work because of icon position caching in DefaultDesktopManager (the setWasIcon() method). It assumes that the frame should recalculate icon position even if the icon is hidden. Therefore, BasicInternalFrameUI and BasicDesktopIconUI both should recalculate icon position.
14-01-2008

EVALUATION It is reproduced with the latest JDK 1.7
09-01-2008