Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-11-2010, 07:45 PM   PM User | #1
earni23
New Coder

 
Join Date: Feb 2010
Posts: 95
Thanks: 14
Thanked 0 Times in 0 Posts
earni23 has a little shameless behaviour in the past
Changing x-value while holding key down

Hi
How do I increase the x-value by 20/sec while holding down the upper-key? If I have been holding the upper-key down for 5 sec the x-value should be 100 if initial x-value is 0.
earni23 is offline   Reply With Quote
Old 11-11-2010, 11:08 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,747
Thanks: 4
Thanked 2,465 Times in 2,434 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
By implementing the KeyListener interface or extending the KeyAdapter.
I think the keyPressed event fires until it reaches the keyReleased, and if it doesn't continually fire it doesn't matter since you can simply use KeyPressed as a start, and keyReleased as an end. Tie that in with a variable to listen to them, or using a thread and it can constantly update the variable for you.
__________________
PHP Code:
header('HTTP/1.1 420 Enhance Your Calm'); 
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
earni23 (11-13-2010)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:57 PM.


Advertisement
Log in to turn off these ads.