aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Please help - setMnemonic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Please help - setMnemonic" Watch "Please help - setMnemonic" New topic
Author

Please help - setMnemonic

Tatiana Hyde
Greenhorn

Joined: Dec 06, 2003
Posts: 12
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

Joined: Mar 17, 2004
Posts: 100
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.


SCJP 1.4, SCJD 1.4, SCBCD (Preparing!)
Tatiana Hyde
Greenhorn

Joined: Dec 06, 2003
Posts: 12
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

Joined: Mar 17, 2004
Posts: 100
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

Joined: Dec 06, 2003
Posts: 12
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please help - setMnemonic
 
Similar Threads
Accelerator/Mnemonics
Open an HTML page in IE or Netscape from Java Application
About java.awt.Robot
How to mask Alt + Tab and Alt + Esc
Keyboard shortcuts for 'Menu bars in an Applet' not working!!