Home » sprite


Handling Keyboard Input and Mouse Events

Keyboard Input and Mouse Events In this example, I show you some simple input examples using Applets. Later I might add Web Start or even Swing Desktop examples. Here we get keyboard input (typing) as keyDown event. And we get mouse positions and clicks. We demonstrated mouse input as move, clicks and mouse drag and drop with a more complex example using a vector sprite stickman. See also Sound Effects and Music Keyboard Input Here I give you sample HTML needed. Put the source and HTML in the same folder and compile the source with ‘javac KeyTest.java’ Save this as ‘keyboard.html’ then run it at the console with ‘appletviewer keyboard.html’ . Note that you will have to give the window focus by clicking it, then when you press a key, output in the console...