This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Swing GUI formatting problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Swing GUI formatting problem" Watch "Swing GUI formatting problem" New topic
Author

Swing GUI formatting problem

Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 685
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?

A version of this program is at: http://users.mo-net.com/normandpaula/DuplicateScorer.jar

I'm using Java 1.5 in Windows XP on a 1.3GHz system.

Thanks,
Norm
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

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?


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 685
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?

Thanks,
Norm
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 685
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.

Norm
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Swing GUI formatting problem
 
Similar Threads
Start Swing GUI program by Java Web Start with IE in Eclipse debug mode
GPS projects
Request suggestions for improving tools
Swing Application Problems
JAR with no Command Prompt involved