JDK-4040417 : Busy Cursor in application
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.1
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5.1
  • CPU: generic
  • Submitted: 1997-03-21
  • Updated: 1998-09-26
  • Resolved: 1998-09-26
Related Reports
Duplicate :  
Description
When I set the cursor on my application to a busy cursor, and I move the
mouse around, I notice that the Text fields still have their normal cursor - and
not the busy cursor.

This behaviour is seen on Unix as well as on NT.


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();
	}
}
nasser.nouri@Corp 1997-05-01

Comments
SUGGESTED FIX we should probably have a default cursor for each class and a current cursor for each instance. then we should walk up the tree twice. the first time checking for instance cursors and if we get all the way to the root and it's set to the default, make a second traversal looking for the first class cursor. this will provide the inheritance behaviour with the ability to have a default per class and yet still override that default at the frame level. this is more change than we should attempt by monday so i'm just going to lower the priority to three and leave the bug open.
11-06-2004

EVALUATION this is a problem, but just barely. you can work around it by explicitly setting the cursor of the text area. jonathan.locke@Eng 1997-05-02
02-05-1997

WORK AROUND just set the component's cursor to a wait cursor. jonathan.locke@Eng 1997-05-02
02-05-1997