• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Swing GUI formatting problem  RSS feed

 
Master Rancher
Posts: 3270
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Norm Radder
Master Rancher
Posts: 3270
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Master Rancher
Posts: 3270
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!