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

Setting an application-wide cursor

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 1.4.2
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      A DESCRIPTION OF THE REQUEST :
      It would be nice to be able to set an application-wide cursor, which overrides all other cursor settings.
      In this way it will be easier to show a wait cursor when a long operation is going on. It is now a lot of work with glasspanes to achieve that, and it's not even possible to show a wait cursor on a window which has a modal child.

      JUSTIFICATION :
      Giving users feedback about progress is very important to give a good UI experience. The wait cursor is a very recognizable way of showing the user the program is busy. Therefore, showing a wait cursor should be a matter of one statement.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      One function, like Toolkit.setApplicationCursor(Cursor.WAIT_CURSOR) that overrides all component specific cursors.

      ---------- BEGIN SOURCE ----------

      Toolkit.getCurrentToolkit().setApplicationCursor(Cursor.WAIT_CURSOR);

      Runnable task = new VeryLongTask();

      Thread taskThread = new Thread(new Runnable()
      { public void run () {
        task.run();
        SwingUtilities.invokeLater(new Runnable() { public void run()
      { Toolkit.getCurrentToolkit().setApplicationCursor(null); }
      }});
      taskThread.start();
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Right now, it is not possible to show a busy cursor on frames that have modal children.
      For other frames, something like

      JFrame[] frames = all_frames;
      for(int i = 0;i<frames.length;i++)
      {
         Component gp = frames[i].getGlassPane();
         gp.setVisible(true);
        gp.setCursor(waitcursor);
      }

      Runnable task = new VeryLongTask();

      Thread taskThread = new Thread(new Runnable()
      { public void run () {
        task.run();
        SwingUtilities.invokeLater(new Runnable() { public void run()
      {
      for(int i = 0;i<frames.length;i++)
      {
         Component gp = frames[i].getGlassPane();
         gp.setVisible(false);
        gp.setCursor(defaultcursor);
      }
       }
      }});
      taskThread.start();
      ###@###.### 2004-12-14 22:15:52 GMT

        Attachments

          Activity

            People

            Assignee:
            osemenovsunw Oleg Semenov (Inactive)
            Reporter:
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Imported:
              Indexed: