JDK-4040388 : Frame.setCursor() sometimes doesn't update the cursor until user moves the mouse
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.1,1.1.5
  • Priority: P1
  • Status: Closed
  • Resolution: Fixed
  • OS:
    solaris_2.5.1,solaris_2.6,windows_95,windows_nt solaris_2.5.1,solaris_2.6,windows_95,windows_nt
  • CPU: generic,x86,sparc
  • Submitted: 1997-03-20
  • Updated: 1998-08-13
  • Resolved: 1998-08-13
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.
Other Other Other
1.1.4 1.1.4Fixed 1.1.6Fixed 1.2.0Fixed
Related Reports
Duplicate :  
Relates :  
Description
This bug only happens on Windows 95 and Windows NT.

This bug can be reproduced in the following scenario:
- select a menu from the menubar
- select a menu item and don't move the mouse
- the menu item handler sets the busy cursor, does some processing, then reset
  the cursor back to the default cursor.
- you will see that the busy cursor stays until the user moves the mouse.


ingrid.yao@Eng 1997-12-10

No longer works in 1.1.5FCS - 1.1.5 regression bug.

copy test case from bug 4037573:
==============================================

import java.lang.*;
import java.awt.*;
import java.awt.event.*;

public class cursortest extends Frame implements WindowListener, ActionListener
{
	Button   bdat= new Button("Start Busy");
	public cursortest()
	{

		bdat.addActionListener(this);
		Panel p = new Panel();
		p.setLayout( new BorderLayout() );

		add( p );
		p.add( "North", bdat );
		p.add( "Center", new TextArea( 20, 20 ) );
		addWindowListener(this);
	}

	public void windowClosed(WindowEvent event) {
	}

	public void windowOpened(WindowEvent event) {
	}

	public void windowIconified(WindowEvent event) {
	}

	public void windowDeiconified(WindowEvent event) {
	}

	public void windowActivated(WindowEvent event) {
	}

	public void windowDeactivated(WindowEvent event) {
	}

	public void windowClosing(WindowEvent event) {
			System.exit(0);
	}

	public void actionPerformed( ActionEvent event)
	{
		Object source = event.getSource();
		if ( source == bdat)
		{
			setCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) );
			System.out.println("Starting Sleep for 5 seconds ...");
			System.out.println("Remember to remove your hand from the mouse");
			try { Thread.sleep(5000); } catch( InterruptedException e ){ }
			System.out.println("Done sleeping");
			setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) );
		}
	}

	public static void main( String args[] )
	{
		Frame f = new cursortest();
		f.setSize( 200, 200 );
		f.show();
	}
}



Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.2alpha FIXED IN: 1.1.4 1.1.6 1.2beta3 INTEGRATED IN: 1.1.4 1.1.6 1.2beta3 VERIFIED IN: 1.1.5
14-06-2004

SUGGESTED FIX Replacing Javasoft's fix with Oracle's original suggested fix resolves both issues (507960 and 635654). Our original fix is simply to call SetCursorPos, immediately after calling GetCursorPos, so the end of sun_awt_windows_WComponentPeer_setCursor() (in awt_Component.cpp) becomes: ... POINT pt; ::GetCursorPos(&pt); ::SetCursorPos(pt.x, pt.y); }
11-06-2004

PUBLIC COMMENTS Frame.setCursor() sometimes doesn't update the cursor until user moves the mouse
10-06-2004

EVALUATION The description describes a bug in some Java application or test app, but that application isn't described nor is it attached. Please send me the app described in the problem report. lynn.mcconnell 5/2/97: Tom, we are in luck. The dup 4037573 does provide a reproducible case. The setCursor native code was changed to force the cursor to redisplay regardless of whether the component the mouse is over is the component being set. This works because the component's new cursor is set and then the mouse-over component is asked to display whatever cursor is set, so if it's a different window the existing cursor will remain. Code-reviewed by jstar. Mike commented out the fix for this -- he now owns this bug. thomas.ball@Eng 1997-12-10 mike.somlo@eng 1997-12-10: Fixed SetCursor by re-inserting MouseMove simulation & passing in mouse state in wParam. Code Reviewed by Robert Bruce. mike.somlo@eng 1997-12-16: Fixed and checked in to 1.2 workspace. ingrid.yao@Eng 1997-12-17 Oracle sent email that after integrating the change into 1.1.5FCS, it did solve the problem.
16-12-1997