Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please help - setMnemonic

 
Tatiana Hyde
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have to upload my assignment in a few hours time and have just found a bug!
I have set the mnemonic on my book button to KeyEvent.VK_B and when I use Alt + B it works fine but as soon as I click on the book button to book a contractor and thereafter use the Alt + B, my program just hangs.
Please can you help me with any ideas/suggestions - it would be very much appreciated.
Thanks in advance,
TH
 
Min Huang
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think its *probably* not related to setMnemonic, as there's really little you could do with that method to have it blow up in your face.
Maybe check your logs? Is it in client mode? If you don't set a socket timeout and the server shuts down, the client will hang for a loooooooooong time waiting for the server to respond.
 
Tatiana Hyde
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Min,
Thanks very much for your reply.
To explain a bit more, when I click on my Book button, the customer id dialog is displayed for the user to enter an id. If I click on the book button, this dialog is displayed correctly and works fine. If I use Alt + B, the dialog is also displayed properly. But, once I follow the process of clicking on the book button, (then clicking on the cancel button in the customer id dialog) and then pressing Alt + B, the customer id dialog is displayed for about half a second, disappears and then my program hangs. Could this be related to how the dialog is being displayed?
Thanks, TH
 
Min Huang
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds unlikely for any of the Java API messing up. To convince yourself (and me) of this, try doing the same exact process with another button that has a mnemonic set. It probably won't happen.
Instead, I suggest checking your code around the actionPerformed method or the constructor for your customer id dialog (if you have one). What gets changed there? What's the last message displayed in your logs when the program hangs?
Are you doing an intensive calculation on a button click? Your swing application is probably not multithreaded (at least, not in the GUI), so intensive calculations will freeze up the GUI for a while.
Hope you find the bug.
 
Tatiana Hyde
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Min
Thanks again for your replies.
I managed to sort the problem out - it had to do with the customer id dialog constructor (like you said) and the frame reference parameter passed to it.
Thanks,
TH
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic