KeyListener

Discussion in 'Java' started by Bumsys@gmail.com, Aug 19, 2008.

  1. Guest

    How add KeyListener to JFrame?
    Simply I want that when I press F5 the content of JFrame refresh.
     
    , Aug 19, 2008
    #1
    1. Advertising

  2. Guest

    I add JPanel to JFrame with setContentPane(panel) and KeyListener does
    not work. If I do not write setContentPane(panel) then KeyListener
    work normally. What is the reason?
     
    , Aug 19, 2008
    #2
    1. Advertising

  3. On Aug 19, 6:57 pm, wrote:
    > I add JPanel to JFrame with setContentPane(panel) and KeyListener does
    > not work. If I do not write setContentPane(panel) then KeyListener
    > work normally. What is the reason?


    System.out.println( panel.isFocusable() );
    System.out.println( panel.hasFocus() );

    If that print out does not fix the problem for you,
    you might try posting an SSCCE* of failing code.

    * <http://pscode.org/sscce.html>

    --
    Andrew Thompson
    http://pscode.org/
     
    Andrew Thompson, Aug 19, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. apchar
    Replies:
    3
    Views:
    1,851
    Andrew Hobbs
    Feb 3, 2004
  2. JariTapio

    KeyListener vs. Runnable ???

    JariTapio, Mar 25, 2005, in forum: Java
    Replies:
    2
    Views:
    749
  3. Max

    JWindow KeyListener

    Max, Oct 29, 2005, in forum: Java
    Replies:
    4
    Views:
    3,783
  4. Luc The Perverse

    KeyListener

    Luc The Perverse, Nov 12, 2005, in forum: Java
    Replies:
    2
    Views:
    804
    Luc The Perverse
    Nov 12, 2005
  5. JavaEnquirer

    KeyListener losing its way

    JavaEnquirer, Dec 20, 2005, in forum: Java
    Replies:
    0
    Views:
    415
    JavaEnquirer
    Dec 20, 2005
Loading...

Share This Page