Posted on 2000-01-20
Medium Priority
Last Modified: 2010-04-01
I want to decode the keyb. I tryes to to find the key pressed, with KeyEvent and it worked !
But how can I find out when multiples keyes are used. eg. Enter & Spacebare is pressed at the same time ??
Question by:win32
  • 2

Expert Comment

by:Jan Louwerens
ID: 2373098
well, you will get KEY_PRESSED and KEY_RELEASED events for each key. If you get KEY_PRESSED events for both keys before getting any KEY_RELEASED events for either, then you'll know they are both down at the same time. You'll have to keep track of which keys you get these pressed and released events for...

Accepted Solution

DrBeaker earned 900 total points
ID: 2374436
Every time a key is pressed you will get a KEY_PRESSED event.  This event will be repeated every few hundred ms while the key is held down.

When the key is released you get a KEY_RELEASED event.

You need to keep track of the state of each key you are interested in to be able to detect multi-key presses.

Actually, you can be clever and detect the difference betweeen CTRL-ALT-DEL and ALT-CTRL-DEL.  This can be good for easter eggs and back doors etc.


Author Comment

ID: 2398317
Hmm year I found out just after i posted this message. But hey you will get the points anyway !! :-)

Expert Comment

by:Jan Louwerens
ID: 2401021
Hey!! I wrote that answer first!!
Why did DrBeaker get the points??

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question