JButton Key Pressed Problem

Super26
Super26 used Ask the Experts™
on
I have been getting a small problem with one of my JButton's ever since I changed the look and feel of my application to a Windows style.  What happens is I have an OK button in the initial panel of my application.  Once I use the tab keys and press OK it closes this panel and goes to another panel, then when I use the tab keys and press the Close button in that 2nd panel, it is supposed to go back to the initial page.

But once I changed to a Windows look, once I tab and Close that 2nd page, it goes back to the initial page but automatically presses the OK button again.  I think when I use the tab keys, the OK button remains pressed.  All I want to do is just put the OK button in a normal state instead of a pressed state.  Is there any way to get rid of this problem.  I hope I am making my problem clear.  Thanks.  
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
in your keyPressed(KeyEvent e)

did u try
e.setKeyCode(KeyEvent.KEY_RELEASED);

vemul

Author

Commented:
That piece of code is mostly working, it is not taking me back to the 2nd page again.  But the OK button appears pressed, like we are clicking down on the button.  Is there any way to make it look normal, not pressed?  Thanks so much for your help.

Author

Commented:
Oops, sorry Vemul, I accidentally put that code in the KeyReleased method.  Everything is working now.  Thanks a bunch!

Commented:
great.. for a moment I was confused as to what u were saying.. :-)

good luck

vemul

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial