Click to See Complete Forum and Search --> : Binding of the 'ENTER' and 'ESCAPE' buttons
Naron Souksaly
May 1st, 2000, 01:33 PM
Hi everyone,
Do you know how to bind the "ENTER" and the "ESCAPE" buttons to specific buttons in our
application. Let say, I have a "SKIP" button on one panel and I want to bind the "ESCAPE" button
to that "SKIP" button, how can I do that?
Thanks,
Naron
sush
May 2nd, 2000, 09:55 AM
Hi Naron,
U can bind keys such as 'enter' etc, using the java.awt.event.KeyEvent class. Use the keycode constants such as KeyEvent.VK_ENTER which corresponds to the 'enter' key.
The Java API provides a whole list of keycodes corresponding to the ASCII values. Hope this helps..
Regards,
Sushma
Naron Souksaly
May 2nd, 2000, 01:05 PM
Hi Sushma,
I tried to use the function "addKeyListener()" because my class is a subclass of JPanel. However,
it doesn't work. It seems the JPanel doesn't have the focus. I tried the same function on a textfield
and it works fine , no problem. Do you know how to use the "addKeyListerner()" on a JPanel or its
subclasss.
Thanks,
Naron
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.