File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Game Development and the fly likes Detecting control or alt key pressed Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Game Development
Reply Bookmark "Detecting control or alt key pressed" Watch "Detecting control or alt key pressed" New topic
Author

Detecting control or alt key pressed

Mich Robinson
Ranch Hand

Joined: Jun 28, 2009
Posts: 176
To integrate one of my games into the mame environment I need to use the standard keys. For this I need to be able to detect if the control key or the Alt key has been pressed. Please note that other keys may (or may not) be pressed at the same time.

I'm currently using the keyDown method but this won't do it.

Any ideas?


Arcade : Alien Swarm
Board : Chess - Checkers - Connect 4 - Othello
Mich Robinson
Ranch Hand

Joined: Jun 28, 2009
Posts: 176
Turned out I just needed to use the newer keyPressed routines rather than the ancient keyDown ones I was using.
 
 
subject: Detecting control or alt key pressed
 
Threads others viewed
Key Event of Special Keys on Keyboard
how to create small windows
Key disableing from our Application
simple question about swing?
how to combine keys
IntelliJ Java IDE