Is this your first time here? SwingWiki is a Java Swing Developer community site with an big archive of Swing-related usenet groups and mailing lists, but also tips, tricks and articles and book reviews written by your colleagues from around the world. If you came here through a search engine and did not find what you were looking for, make sure to check the wiki table of contents.

Cursor change "not working"

If you change the active Cursor shape, and it does not show, than you have a classic Swing Threading problem. The easy way to solve the problem is to change the cursor from another Thread, and then change it back when the work is finished, just before ending the Thread. For a more detailed explanation of what is going on, read Swing Threading.

  private class ThrdVC implements Runnable{
    public void run(){
       // do some work
       SwingUtilities.invokeLater(new Runnable(){
           public void run(){
       } // swingutilities
  } // ThrdVC
  // instead of changing cursors and calling doSomeWork directly in this
  // method, run it in a separate thread
  public void actionPerformed(){
     new Thread(new ThrdVC()).start(); // start the thread

Comments? Corrections? Contact us or Login to edit pages directly (registration is free and takes less than displaying a JLabel)
  workaround/cursor_change_not_working.txt · Last modified: 2005/02/14 07:51 by (gojko)
Recent changes | RSS changes | Table of contents | News Archive | Terms And Conditions | Register | The Quest For Software++| Ruby Resources

Sedo - Buy and Sell Domain Names and Websites project info: Statistics for project etracker� web controlling instead of log file analysis