Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

My app has a main menu with 3 JButtons, and clicking on any button calls a new submenu.
If I press the ESC key at any submenu, the app is closed.

But something strange happens when I press some button for a moment without generating the click event.
While I´m pressing the button, the bitmap is changed for the one I set with setPressedIcon - as expected. Then I place the mouse cursor out of the button area and release the button.

Now what: I press the ESC key to close my app and nothing happens.
I need to click one of the buttons, to move to any other submenu.
Then the app can respond to the ESC key and closes.
The same effect of the screen getting deaf after I press a button happens on any submenu.
What can be wrong with my app ?

Thanks in advance,
Emerson

What I have tried:

I am not experienced with Java event handling so I didn´t try anything by now.
I only verified that all the submenus have the same behavior.
Further, if I pass from the main menu to a submenu, and then back to the main menu, this returns to work normally (of course, since I don´t press some of the buttons before pressing the ESC key).
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900