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

setCursor fails for JApplet's frame on win32

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.0.2
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic
    • OS:
      windows_nt

      Description

      When a JApplet is embedded in a JFrame, and setCursor is called for the JApplet's AWT Frame parent, the setCursor call works properly on Solaris but
      fails on win32.

      Either the cursor does not change at all on win32, or it becomes a Wait Cursor
      while positioned over the JButton, then reverts to the Default Cursor when the
      mouse is moved off the button. When the button is clicked a second time, the
      Wait Cursor fails to appear at all.

      This bug presents a particular problem for client applications that set the cursor to Wait Cursor while performing an RMI call. If the cursor is not set properly, the user will often attempt to resubmit the data, clicking the mouse or hitting the return key multiple times, causing the client-side application to hang. The client must be killed, which interrupts RMI on the server. When interrupted, RMI may fail to clean up nicely, and it then needs to be restarted on the server before the client-side application can be restarted.

      The JDK used is 1.1.6, the Swing version 1.0.3.

      Below is a test case:

      -------------------------------- TestCursor2.java ----------------------------

      import java.awt.*;
      import java.awt.event.*;
      import com.sun.java.swing.*;


      public class TestCursor2 extends JApplet {

          Frame appletFrame;

          public void init() {
          JPanel panel = new JPanel();
          JButton okButton = new JButton("OK");
          okButton.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
              appletFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
              }
          });

          panel.add(okButton);
          getContentPane().add(panel);
          appletFrame = getAppletFrame();
          }

          private Frame getAppletFrame() {
              Component p = getParent();
              while ((p != null) && (!(p instanceof Frame))) {
                  p = p.getParent();
              }
              return (Frame)p;
          }

          public static void main(String args[]) {
          TestCursor2 test = new TestCursor2();
          JFrame frame = new JFrame();
          frame.addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) {
                      System.exit(0);
                  }
              });
          frame.setSize(200,200);
          frame.setLocation(200,200);
          frame.getContentPane().add(test);

          test.init();
          frame.show();
          }
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tballsunw Tom Ball (Inactive)
              Reporter:
              nrodinsunw Nick Rodin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: