hello!
is there a method or class that lets you assign events to the keys of your keyboard (spacebar to fire gun)? and is there a way to measure how long the key was held down? thanks!!! any help is greatly appreciated.. ive tried google-ing it but i had no luck in looking for a class/method that does those things =) tnx
esy928
0
Light Poster
Recommended Answers
Jump to PostKeyListener
Using keyListener
You need to implement it, and then add a listener with addKeyListener(this) and you need to use all of the methods provided because it is a interface (they …
Jump to PostWhy not store the current time in a data type (like a long) when the key is pressed and when the key is released subtract the new time from the old time?
Here's an example--
public class ImprovedClock{ private volatile long first = 0, second = …
All 6 Replies
jasimp
427
Senior Poster
Featured Poster
esy928
0
Light Poster
jasimp
427
Senior Poster
Featured Poster
Alex Edwards
321
Posting Shark
Alex Edwards
321
Posting Shark
esy928
0
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.