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
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.