• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

JTable Freezes...Help!

 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 1033
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic