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 Developer Certification (SCJD/OCMJD) and the fly likes JTable Freezes...Help! 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 » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "JTable Freezes...Help!" Watch "JTable Freezes...Help!" New topic
Author

JTable Freezes...Help!

Daniel Simpson
Ranch Hand

Joined: Sep 02, 2004
Posts: 181
Hey, I'm doing B&S and I am having trouble with my JTable freezing when I attempt to book a Contractor multiple times. Here is what happens:

1)Contractor is available to book-->Click on row, enter id, hit book. That works fine.
2)Select the same contractor and try booking: "Sorry record #.. is already booked."
3)Again, try doing the same thing as step 2, but when I click book, the book button freezes and the whole application hangs. Any ideas?

Here is a little rough snippets of code:

Here is a snippet in my GUIController:


Hope my code snippets help with this problem. Does anybody have any idea why my program would hang when it does that? Has anyone else experienced problems with that? My search works fine, I can hit the search button 100 times in a row and it doesn't hang. Hmmmm....
[ December 31, 2004: Message edited by: Daniel Simpson ]

SCJP 1.4<br />SCJD 1.4
peter wooster
Ranch Hand

Joined: Jun 13, 2004
Posts: 1033
Originally posted by Daniel Simpson:
Hey, I'm doing B&S and I am having trouble with my JTable freezing when I attempt to book a Contractor multiple times. Here is what happens:

1)Contractor is available to book-->Click on row, enter id, hit book. That works fine.
2)Select the same contractor and try booking: "Sorry record #.. is already booked."
3)Again, try doing the same thing as step 2, but when I click book, the book button freezes and the whole application hangs. Any ideas?

Here is a little rough snippets of code:

Here is a snippet in my GUIController:


Hope my code snippets help with this problem. Does anybody have any idea why my program would hang when it does that? Has anyone else experienced problems with that? My search works fine, I can hit the search button 100 times in a row and it doesn't hang. Hmmmm....

[ December 31, 2004: Message edited by: Daniel Simpson ]


Do you do your database access on the Event Dispatch Thread? Does another thread try to update the GUI? Either of these could cause problems with responsiveness. I do the following:

All business actions that might access a file or the network start a thread to do it. When that action completes it uses invokeLater to get the GUI work done on the EDT. This way there are no possible blocking actions on the EDT and all GUI activity does run there.
Daniel Simpson
Ranch Hand

Joined: Sep 02, 2004
Posts: 181

This code is similar to the example project used by Max in his book. I didn't see anywhere with him using invoke later (however, even though i followed the compiling instructions completely, i could never get it the application to run [i kept getting a db connection error].) So I'm assuming Max's doesn't freeze if you keep trying to book the same contractor over and over. Who knows...I tried the invoke later and still froze.

[ January 02, 2005: Message edited by: Daniel Simpson ]
[ January 02, 2005: Message edited by: Daniel Simpson ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTable Freezes...Help!
 
Similar Threads
jtable
Problem With JTable
JTable remove rows trouble.
JTable Trouble
JTable ........