Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4475859

The hourglass cursor neve comes back after move out of dialog



    • Bug
    • Status: Closed
    • P4
    • Resolution: Duplicate
    • 1.4.0
    • None
    • client-libs
    • x86
    • windows_nt


      Name: bsC130419 Date: 06/28/2001

      C:\tmp>\jdk1.3.1\bin\java -version
      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

      use "setCursor" API to set up a busy cursor in a modal dialog.
      When "Apply" button clicked, use "setCursor" to set up a "WAIT"
      cursor, then execute a long task, after the task is finished, use
      "setCursor" to set back to "DEFAULT" cursor.
      In Solaris 2.7(x86), both jdk 1.3.1 and jdk 1.2.2 run well.
      but in Windows NT 4.0, jdk1.2.2 is OK, jdk 1.3.1 is not OK.
      After the cursor becomes an hourglass, use the mouse to move it out of
      the dialog, then move it back, the "hourglass" never comes back.

      Please compile and run the sample code.
      1. javac test_dialog.java
      2. javac test.java
      3. java test
      4. click OK button
      5. click Apply button, cursor becomes hourglass
      6. move cursor out of the dialog, then move cursor back,
         you see cursor keeps "arrow" shape, not hourglass

      ----test_dialog.java (start)--------

      import java.awt.*;
      import javax.swing.*;
      import java.awt.event.*;

      public class test_dialog extends JDialog

          JPanel base_panel = new JPanel();
          BorderLayout borderLayout1 = new BorderLayout();
          JPanel up_JPanel = new JPanel();
          BorderLayout borderLayout2 = new BorderLayout();
          JPanel down_JPanel = new JPanel();
          JButton jButtonApply = new JButton();
          JButton jButtonOK = new JButton();
          JButton jButtonCancel = new JButton();

          public test_dialog(Frame frame, String title, boolean modal)
              super(frame, title+" dialog cursor", modal);
              catch(Exception ex)

          public test_dialog()
              this(null, "", false);

          void jbInit() throws Exception
              jButtonApply.setMinimumSize(new Dimension(83, 27));
              jButtonApply.addActionListener(new java.awt.event.ActionListener()

                  public void actionPerformed(ActionEvent e)
              jButtonOK.setMinimumSize(new Dimension(83, 27));
              jButtonOK.addActionListener(new java.awt.event.ActionListener()

                  public void actionPerformed(ActionEvent e)

              jButtonCancel.setMinimumSize(new Dimension(83, 27));
              jButtonCancel.addActionListener(new java.awt.event.ActionListener()

                  public void actionPerformed(ActionEvent e)
              base_panel.setPreferredSize(new Dimension(420, 575));

              up_JPanel.setPreferredSize(new Dimension(386, 480));
              base_panel.add(up_JPanel, BorderLayout.CENTER);
              base_panel.add(down_JPanel, BorderLayout.SOUTH);
              down_JPanel.add(jButtonOK, null);
              down_JPanel.add(jButtonCancel, null);
              down_JPanel.add(jButtonApply, null);

          FlowLayout flowLayout1 = new FlowLayout();

          void jButtonApply_actionPerformed(ActionEvent e)

                      try {
                          Thread.sleep(10000); //sleep for 10 seconds
                      } catch (InterruptedException e1) {


      ----test_dialog.java (end) ---------

      ----test.java (start)-----------
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class test extends JFrame
          public test()
              JPanel aJPanel = new JPanel();

              JButton aJButton = new JButton("OK");
              aJButton.addActionListener(new java.awt.event.ActionListener()

                  public void actionPerformed(ActionEvent e)
              setSize(new Dimension(300,300));

          void ok_action(ActionEvent e)

                test_dialog atest_dialog = new test_dialog(this, "test", true);


          public static void main(String[] args)
              test atest = new test();

      ----test.java (end)-------------
      (Review ID: 125361)


        Issue Links



              rraysunw Richard Ray (Inactive)
              bstrathesunw Bill Strathearn (Inactive)
              0 Vote for this issue
              0 Start watching this issue