Checking every key is a bit over kill, for simple WASD type keyboard control it's fine, but if you want to capture typing in a dialog box for example, it's alot more effort than would be nice. There is the event model also. Instead of asking 120 times if a particular key has been pressed, you just ask the device for the events since the last poll.

first of all you forgot to poll the keyboard with keyboard.poll() at the beginning of the while loop. in addition this wont work on my windows vista as well. i tryed to start it from inside eclipse as well as from the command line but it didnt work. as soon as i use the same code in an application that uses a JFrame it starts to work tho. any ideas why it acts like that? (just a wild guess: probably DInput needs a window that implements a callback for the keyboard handling?)

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org