How would you make it so that you check if the user has pressed the keys up, down, w or s every half a second

Check out the Java API for documentation on the KeyListener interface. This interface provides the necessary tools for listening for key presses. Depending on what you are trying to do though, it might be better to interrupt rather than listen for the key press.

Check out the Java API for documentation on the KeyListener interface. This interface provides the necessary tools for listening for key presses. Depending on what you are trying to do though, it might be better to interrupt rather than listen for the key press.

well im making pong, so i need to kno when the user clicks up or down to move the paddle

So what did you not understand about his post? Read the API docs for KeyListener.

commented: not very nice +0
commented: Nothing mean about repeating a suggestion the poster seemed to ignore. +12
commented: Approved! =) +4
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.