Results 1 to 16 of 16
- 09-18-2010, 10:24 PM #1
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
KeyListener doesnt work some times.
Hello
Because people did not realise that I NEED to learn to hack
(to prevent slaughter of christians in a couple of years)
and instread decided to becoming jerks,I decided
to do something else. A 2d simple game.
now, for no reason what so ever!
The key listener stops working! :(
I added it to the JFrame AND to the JPanel contaning my
drawings of sqares but now it stopped working AGAIN!!
First it works. you can drive you lil helicopter, but then suddenly during
one my my debugs, it stops working.
No input is gatherd whatso ever!
Why?
- 09-18-2010, 11:17 PM #2
Hard to tell without more info about the code and the OS it is running on.
Does the component with the listener have the focus?
- 09-19-2010, 01:13 AM #3
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4
- 09-19-2010, 08:40 AM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,606
- Blog Entries
- 7
- Rep Power
- 17
- 09-19-2010, 10:18 AM #5
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
Yes I think so.
I got a JLabel inside a JFrame and thats all.
When I click it, one of them should get the focus right?
- 09-19-2010, 10:21 AM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,606
- Blog Entries
- 7
- Rep Power
- 17
-
- 09-19-2010, 05:23 PM #8
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
Dear Josh,
I realize that you are talking with eloquence in order to attain credibility
that you are of superior kind when arguing over these mathers.
I will therefore reply in the same elocutio.
Allow me to inform sir that I have not failed to furfilled every rules
applied to this specific page. Rather I came with a non-debateable
statement that the end of time is certainly approaching.
As for my real question:
Soo..
I got a JFrame, yet the keylistener stops working at random points
when I debug..
Hum.. Should I use something else instead of keylistener?
- 09-19-2010, 05:54 PM #9
Could you post a small program that compiles and executes and demonstrates your problem?
- 09-21-2010, 03:00 PM #10
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
Found out what it was.
I forgot to add:
@Override
thingy over my methods.. -.-
- 09-21-2010, 03:40 PM #11
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Sometimes this place really throws up some surprises...:)
- 09-21-2010, 03:56 PM #12
But that doesn't explain the "sometimes" aspect of the problem. Either the method was an override or it wasn't
- 09-21-2010, 03:59 PM #13
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
Idk why, but it stopped it.
It works always now, as before only worked 50% of the time.
-
As far as I know, @Override will only effect the compilability of the code, not the behavior of the code.
- 09-21-2010, 04:15 PM #15
AFAIK Computers are very consistent. There has to be something else about your code that allowed the "sometimes" aspect of the problem.
- 09-21-2010, 04:25 PM #16
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Similar Threads
-
PrintWriter doesnt work :(
By Addez in forum New To JavaReplies: 11Last Post: 01-17-2010, 05:59 PM -
mysql connect button doesnt work quite right
By 711groove in forum New To JavaReplies: 0Last Post: 12-13-2009, 07:01 AM -
why doesnt my insertion sort method not work?
By Jeremy8 in forum New To JavaReplies: 7Last Post: 11-15-2009, 02:56 AM -
Dll Call doesnt work
By INFACT in forum New To JavaReplies: 1Last Post: 10-04-2009, 09:31 PM -
java doesnt allow vista to work
By 10rosas in forum New To JavaReplies: 5Last Post: 12-22-2008, 04:23 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks