I have a JTable that will reload sorted data from the database when the user clicks on a column header. MainView (JFrame) contains the GUI elements that will create a new SwingWorker and start it. The SwingWorker's doInBackGround() function changes the cursor of the MainView to be the wait cursor. Then when the doInBackground() function is completed doing its work and before it leaves the doBackground function it changes the cursor back to the default cursor.
Sometimes the cursor shows up but after a while it stops showing the cursor each time I click on the header. It probably works the first few times and seems kind of random.
Why does the cursor show sometimes, but not others? Is there a particular way I should be setting the wait cursor? Should I set the wait cursor from the SwingWorker thread or from the MainView GUI thread?