JDK-6557223 : Resize cursor stays after fast outline-resize of JInternalFrame with JScrollPane
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-05-14
  • Updated: 2011-03-08
  • Resolved: 2011-03-08
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 6 JDK 7
6u4Fixed 7 b64Fixed
Description
FULL PRODUCT VERSION :
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

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

A DESCRIPTION OF THE PROBLEM :
If you resize a JInternalFrame containing a JScrollPane in a JDesktop with drag mode JDesktopPane.OUTLINE_DRAG_MODE, it often happens, that the resize cursor doesn't go away until you explicitly leave the internal frame with the mouse.
It doesn't happen in another drag mode and it doesn't happen, if the internal frame doesn't contain a JScrollPane.

This may be connected with 6408077, 6400007, 6364746, 6382650, but their descriptions don't really show, that it's a duplicate.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
It's easiest to reproduce, when you take the lower right corner of the internal frame, make the frame smaller and release the mouse button while you are still moving the mouse. Plus: Move the mouse fast.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
After resize the cursor should go back to the default cursor.
ACTUAL -
The cursor often remains as the resize cursor.

REPRODUCIBILITY :
This bug can be reproduced often.

---------- BEGIN SOURCE ----------
public class InternalFrameCursor extends JFrame
{
    public static void main(String[] args)
    {
        new InternalFrameCursor();
    }
    public InternalFrameCursor()
    {
        JDesktopPane d = new JDesktopPane();
        getContentPane().add(d, BorderLayout.CENTER);

        // Everything is fine without this line
        d.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);

        // This one has the problem
        JInternalFrame i1 = new MyInternalFrame();
        JPanel p1 = new JPanel();
        p1.setPreferredSize(new Dimension(2000,2000));

        i1.setTitle("1: ScrollPane");
        i1.getContentPane().add(new JScrollPane(p1), BorderLayout.CENTER);
        i1.setBounds(50,50,300,300);

        // This one doesn't have the problem
        JInternalFrame i2 = new MyInternalFrame();
        JPanel p2 = new JPanel();
        p2.setPreferredSize(new Dimension(2000,2000));
        i2.setTitle("2: Panel");
        i2.getContentPane().add(p2, BorderLayout.CENTER);
        i2.setBounds(400,400,300,300);

        setSize(800,800);
        d.add(i1);
        d.add(i2);
        setVisible(true);
    }
    private static class MyInternalFrame extends JInternalFrame
    {
        public MyInternalFrame()
        {
            setResizable(true);
            setVisible(true);
        }
        public void setCursor(Cursor cursor)
        {
            // For cursor one the reset is missing
            System.out.println( "Set " + getTitle() + ": " + cursor );
            super.setCursor(cursor);
        }
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
You could reset the cursor yourself in setBounds(), but then the resize cursor is not shown anymore, if you first stop moving and then release the mouse button.

Release Regression From : 5.0u11
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Release Regression From : 5.0u11
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION This bug was caused by the fix in build 6 b53 for 4222821 Iconifying a JInternalFrame causes its GlassPane to lose state Need call to updateFrameCursor() from finishMouseReleased().
04-08-2007

EVALUATION Regression From : 5.0u11
13-07-2007