aspose 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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Game Development
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: 250
    
    1
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: 250
    
    1
Turned out I just needed to use the newer keyPressed routines rather than the ancient keyDown ones I was using.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Detecting control or alt key pressed