|
-
May 1st, 2000, 01:33 PM
#1
Binding of the 'ENTER' and 'ESCAPE' buttons
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
-
May 2nd, 2000, 09:55 AM
#2
Re: Binding of the 'ENTER' and 'ESCAPE' buttons
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
-
May 2nd, 2000, 01:05 PM
#3
Re: Binding of the 'ENTER' and 'ESCAPE' buttons
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|