-
Bug
-
Resolution: Fixed
-
P2
-
1.3.0, 1.3.1, 1.4.0, 1.4.2
-
10
-
x86
-
windows_nt, windows_2000, windows_xp
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2120662 | 5.0 | Harsha Godugu | P2 | Resolved | Fixed | b26 |
JDK-2120661 | 1.4.2_04 | Harsha Godugu | P2 | Closed | Fixed | 04 |
JDK-2120660 | 1.4.1_07 | Harsha Godugu | P2 | Closed | Fixed | 07 |
System Information
==================
Product and Version : Interim JDK v1.3RC1 for UOB Bank, Singapore
Hardware Platform : Intel Pentium II PC
OS Version : Window NT4.0 SP 5
Problem description
===================
In our application, we turn on the busy cursor when the task takes some
time to complete. In the current version of JDK1.3 that we are using (
Note : a special version with 2 patches given by Sun Support), the busy
cursor will disappear (i.e. return to normal) when user starts to move
the mouse around, especially when the mouse is outside of the
application frame. We observed that this seems to happen more frequently
when the application is doing CPU intensive tasks.
If this frame is covered by another window and bgought to front again, the busy cursor always disappears after the frame is restored. Only the cursor part is not restored correctly.
Some people suggested to put the cursor setting thread out of the AWT thread. I have tested it but it does not solve the problem either.
Source Code
===========
import java.awt.*;
import java.awt.event.*;
import java.util.Date;
public class TestCursor
{
static public void main(String args[])
{
TestCursor app = new TestCursor();
GUI gui = new GUI(app);
}
}
class RunHandler implements ActionListener
{
TestCursor app;
GUI gui;
public RunHandler(TestCursor app, GUI gui)
{
this.app = app;
this.gui = gui;
}
public void actionPerformed(ActionEvent ae)
{
gui.setCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) );
gui.setResult("Running...");
int i=0;
while (i<1000000)
{
Date d= new Date();
System.out.println(i + ": " + d.toString());
i++;
}
gui.setResult("Finished.");
gui.setCursor( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) );
}
}
class AboutBox extends Frame
{
class ShutdownAdapter extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{ dispose(); }
}
public AboutBox()
{
super("About TestCursor");
setLayout(new BorderLayout());
setLocation(325,300);
setSize(240,80);
setResizable(false);
TextArea text = new TextArea ("Testing Cursor problem.\n09 Sep 2000");
text.setEditable(false);
add("North",text);
setVisible(true);
addWindowListener(new ShutdownAdapter());
}
}
class MenuHandler implements ActionListener
{
TestCursor app;
GUI gui;
public MenuHandler(TestCursor app, GUI gui)
{
this.app = app;
this.gui = gui;
}
public void actionPerformed(ActionEvent ae)
{
String sCommand = ae.getActionCommand();
if ("Exit".equals(sCommand))
{
gui.dispose();
System.exit(0);
}
else if ("About TestCursor".equals(sCommand))
{
AboutBox about = new AboutBox();
about.toFront();
}
}
}
class GUI extends Frame
{
TestCursor app;
Panel statusPanel;
TextField statusText;
public void setResult(String value)
{
this.statusText = new TextField(value,20);
this.statusText.setEditable(false);
this.statusPanel.removeAll();
this.statusPanel.add(statusText);
pack();
show();
}
class ShutdownAdapter extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{ System.exit(0); }
}
public GUI(TestCursor app)
{
super ("Test Cursor");
this.app = app;
addWindowListener(new ShutdownAdapter());
MenuHandler mh = new MenuHandler(app , this);
MenuBar mBar = new MenuBar();
setMenuBar(mBar);
Menu menu = new Menu("File");
mBar.add(menu);
MenuItem menuItem = new MenuItem("Exit");
menu.add(menuItem);
menuItem.addActionListener(mh);
menu = new Menu("Help");
mBar.add(menu);
menuItem = new MenuItem("About TestCursor");
menu.add(menuItem);
menuItem.addActionListener(mh);
setLayout(new BorderLayout());
Panel testPanel = new Panel();
Button b;
testPanel.setLayout(new GridLayout(1,1));
statusPanel = new Panel();
statusPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
statusText=new TextField("",20);
statusText.setEditable(false);
statusPanel.add(statusText);
add("North",statusPanel);
RunHandler rh = new RunHandler(app, this);
testPanel.add(b = new Button("Press to run")); b.addActionListener(rh);
add("Center",testPanel);
pack();
setLocation(300,300);
show();
}
}
==================
Product and Version : Interim JDK v1.3RC1 for UOB Bank, Singapore
Hardware Platform : Intel Pentium II PC
OS Version : Window NT4.0 SP 5
Problem description
===================
In our application, we turn on the busy cursor when the task takes some
time to complete. In the current version of JDK1.3 that we are using (
Note : a special version with 2 patches given by Sun Support), the busy
cursor will disappear (i.e. return to normal) when user starts to move
the mouse around, especially when the mouse is outside of the
application frame. We observed that this seems to happen more frequently
when the application is doing CPU intensive tasks.
If this frame is covered by another window and bgought to front again, the busy cursor always disappears after the frame is restored. Only the cursor part is not restored correctly.
Some people suggested to put the cursor setting thread out of the AWT thread. I have tested it but it does not solve the problem either.
Source Code
===========
import java.awt.*;
import java.awt.event.*;
import java.util.Date;
public class TestCursor
{
static public void main(String args[])
{
TestCursor app = new TestCursor();
GUI gui = new GUI(app);
}
}
class RunHandler implements ActionListener
{
TestCursor app;
GUI gui;
public RunHandler(TestCursor app, GUI gui)
{
this.app = app;
this.gui = gui;
}
public void actionPerformed(ActionEvent ae)
{
gui.setCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) );
gui.setResult("Running...");
int i=0;
while (i<1000000)
{
Date d= new Date();
System.out.println(i + ": " + d.toString());
i++;
}
gui.setResult("Finished.");
gui.setCursor( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) );
}
}
class AboutBox extends Frame
{
class ShutdownAdapter extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{ dispose(); }
}
public AboutBox()
{
super("About TestCursor");
setLayout(new BorderLayout());
setLocation(325,300);
setSize(240,80);
setResizable(false);
TextArea text = new TextArea ("Testing Cursor problem.\n09 Sep 2000");
text.setEditable(false);
add("North",text);
setVisible(true);
addWindowListener(new ShutdownAdapter());
}
}
class MenuHandler implements ActionListener
{
TestCursor app;
GUI gui;
public MenuHandler(TestCursor app, GUI gui)
{
this.app = app;
this.gui = gui;
}
public void actionPerformed(ActionEvent ae)
{
String sCommand = ae.getActionCommand();
if ("Exit".equals(sCommand))
{
gui.dispose();
System.exit(0);
}
else if ("About TestCursor".equals(sCommand))
{
AboutBox about = new AboutBox();
about.toFront();
}
}
}
class GUI extends Frame
{
TestCursor app;
Panel statusPanel;
TextField statusText;
public void setResult(String value)
{
this.statusText = new TextField(value,20);
this.statusText.setEditable(false);
this.statusPanel.removeAll();
this.statusPanel.add(statusText);
pack();
show();
}
class ShutdownAdapter extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{ System.exit(0); }
}
public GUI(TestCursor app)
{
super ("Test Cursor");
this.app = app;
addWindowListener(new ShutdownAdapter());
MenuHandler mh = new MenuHandler(app , this);
MenuBar mBar = new MenuBar();
setMenuBar(mBar);
Menu menu = new Menu("File");
mBar.add(menu);
MenuItem menuItem = new MenuItem("Exit");
menu.add(menuItem);
menuItem.addActionListener(mh);
menu = new Menu("Help");
mBar.add(menu);
menuItem = new MenuItem("About TestCursor");
menu.add(menuItem);
menuItem.addActionListener(mh);
setLayout(new BorderLayout());
Panel testPanel = new Panel();
Button b;
testPanel.setLayout(new GridLayout(1,1));
statusPanel = new Panel();
statusPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
statusText=new TextField("",20);
statusText.setEditable(false);
statusPanel.add(statusText);
add("North",statusPanel);
RunHandler rh = new RunHandler(app, this);
testPanel.add(b = new Button("Press to run")); b.addActionListener(rh);
add("Center",testPanel);
pack();
setLocation(300,300);
show();
}
}
- backported by
-
JDK-2120662 Disappearing of busy cursor on JDK 1.3
- Resolved
-
JDK-2120660 Disappearing of busy cursor on JDK 1.3
- Closed
-
JDK-2120661 Disappearing of busy cursor on JDK 1.3
- Closed
- duplicates
-
JDK-4475859 The hourglass cursor neve comes back after move out of dialog
- Closed
-
JDK-4533002 CURSOR DOES NOT CHANGE BACK TO AN HOURGLASS
- Closed
- relates to
-
JDK-4320939 WaitCursor-problems in JDK1.3RC1
- Closed
(1 relates to)