Search:

Type: Posts; User: Norm

Search: Search took 0.18 seconds.

  1. Replies
    19
    Views
    1,418

    [SOLVED] Re: keyListener keyPressed not working

    Adding a key listener to a component that can get the focus will work.
    Adding a key listener to a component that is not configured to take the focus won't work until that component's method is...
  2. Replies
    19
    Views
    1,418

    [SOLVED] Re: keyListener keyPressed not working

    Is the MyPanel object able to get the focus? See the doc at the link.
  3. Replies
    19
    Views
    1,418

    [SOLVED] Re: keyListener keyPressed not working

    Did you see this from post#12

    Can the MyPanel object get the focus? Not all components can. You may need to call a method that makes it possible for the MyPanel object to get the focus. It's...
  4. Replies
    19
    Views
    1,418

    [SOLVED] Re: keyListener keyPressed not working

    If you want a reference to the MyPanel object you should use an assignment statement with the new operator. Then use that reference to call the methods and to pass the reference to the add() method....
  5. Replies
    19
    Views
    1,418

    [SOLVED] Re: keyListener keyPressed not working

    Where is the MyPanel object created? Use the reference to the object that is created there to call that object's methods. Or do it in the constructor.

    Can the MyPanel object get the focus? Not...
  6. Replies
    19
    Views
    1,418

    [SOLVED] Re: keyListener keyPressed not working

    Get a reference to the object and use that to call the method.

    Also you should read the tutorial about focus:
    http://docs.oracle.com/javase/tutorial/uiswing/misc/focus.html
  7. Replies
    19
    Views
    1,418

    [SOLVED] Re: keyListener keyPressed not working

    Does the View object get the focus? Add a focus listener to see if it gets and keeps the focus by printing out messages when it gets the focus and when it loses the focus.
    What object has the key...
  8. Replies
    19
    Views
    1,418

    [SOLVED] Re: keyListener keyPressed not working

    Post the code showing where you are trying.
  9. Replies
    19
    Views
    1,418

    [SOLVED] Re: keyListener keyPressed not working

    Does the MyPanel object have the focus?
Results 1 to 9 of 9