This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I normally use AWT for my program's GUI since they mostly have simple user input. For my current project I decided to use Swing. The program is for capturing the stats for Duplicate Bridge. It has a spread sheet style layout with about 20 rows consisting of labels,text fields and radio buttons to hold the data for each hand played.
My problem: when openning (File|Open>..) previously saved data, the window/scroll pane underneath the dialog window for choosing the file to open is cleared and then repainted very SLOWLY.
What can I do to speed up/eliminate the slow repainting?
Could you post some of the code that gets called when a file is opened?
It might be an issue of performing all the processing in the event thread - here's an article about using Threads in Swing.
I tried to test it by running your linked program, but I am also having problems saving... whenever I fill in any data in the form, then press 'Save As...' or 'Save' it throws a NullPointerException before the save dialog is launched. Do all the cells have to be filled in before saving?
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Joined: Aug 10, 2005
Nate, thanks for the response. Yes it was a case of using the wrong thread. I moved the code that reads the file to its own thread and the time for the empty spot to be repainted is acceptable.
Re the null pointer exception: I've since made several other changes to the program and uploaded the new version. Could you please send me a copy of the .log file that shows the tracelog for the exception?
Joined: Aug 10, 2005
Re filling in all the fields: The program is supposed to force you to fill in all the fields on any single line. But you don't have to fill in more than one line for any hand.