Results 1 to 3 of 3
Thread: KeyListener needs to grab focus!
- 05-03-2013, 01:18 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 30
- Rep Power
- 0
KeyListener needs to grab focus!
Hi, thanks in advance to anybody who can help me.
I have two JPanels and a JFrame, I have finally got my image to move on one of the JPanels by using :
Java Code:cp.addKeyListener(myAnimationPanel); cp.requestFocusInWindow();
Java Code:addKeyListener(this); this.requestFocus();
Hope somebody can help me
- 05-03-2013, 01:22 PM #2
Member
- Join Date
- Oct 2011
- Posts
- 30
- Rep Power
- 0
Re: KeyListener needs to grab focus!
Sorry not sure how to delete this thread, literally just figured it out!!
for anybody else having these problems in the paint method put requestFocus(true);
Woo!
- 05-03-2013, 01:28 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 28
Similar Threads
-
A KeyListener that doesn't require focus
By vaano in forum New To JavaReplies: 3Last Post: 11-14-2011, 10:46 PM -
KeyListener ignores key events despite apparently having focus
By jfio in forum AWT / SwingReplies: 4Last Post: 10-30-2011, 07:52 AM -
how to grab info from array
By skuzzie in forum New To JavaReplies: 3Last Post: 12-09-2010, 02:26 PM -
grab the textfile
By Sticks_ll in forum New To JavaReplies: 3Last Post: 03-31-2009, 02:23 PM
Bookmarks