CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Posts
    18

    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




  2. #2
    Join Date
    Apr 2000
    Location
    IL,U.S.A
    Posts
    33

    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


  3. #3
    Join Date
    Apr 1999
    Posts
    18

    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
  •  





Click Here to Expand Forum to Full Width

Featured