aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Is it legal to use SwingWorker in your assignment? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Is it legal to use SwingWorker in your assignment?" Watch "Is it legal to use SwingWorker in your assignment?" New topic
Author

Is it legal to use SwingWorker in your assignment?

Gareth Llewellyn
Greenhorn

Joined: Nov 16, 2005
Posts: 11
Given my swing gui is operating in the event dispatching thread, and my database model is operating in the main thread, I quickly found the gui was sluggish on repainting during long database operations (such as retrieving all records, reg exp pattern matching vs record contents etc.). While my data layer has a cache of record number / file location, the gui is still affected during these time consuming operations. To get round this I simply off loaded time consuming tasks to a SwingWorker implementation, overriding construct() and finish() methods. Given SwingWorker isnt part of the API, but rather a neat helper described by the Swing tutorial, am I even allowed to include this code in my assignment? Do I have to strip this great stuff out and go back to poor performance? My view is calling back into my controller which in turn manipulates my model. Would I have to add some home grown threading support into the controller to handle the time consuming tasks?

Thoughts and opinions welcomed.

To improve the performance (especially repainting) of your Swing GUI, y
Petr Hejl
Ranch Hand

Joined: Feb 26, 2006
Posts: 68
I believe you are not allowed to use SwingWorker. You can submit only your own code. But you can inspire by that and write some similar stuff using Thread and SwingUtilities.invokeLater().

P.
Alan Mc Kernan
Ranch Hand

Joined: Oct 13, 2005
Posts: 59
Hey Gareth,

Hrm.. Iv not had to do any of this SwingWorker stuff(i dont know what it does tbh). And I dont know your assigment, but perphaps you should re-look at some of your GUI code, maybe your table model, and ensure that its calling fireTableDataChanged or equivalent methods when necessary.

I cant imagine a retrieve from database would cause the GUI to slow up. Unless the underlying model is not telling the GUI to refresh its display.

Cheers,
Alan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it legal to use SwingWorker in your assignment?