Is it possible to have the list of down keys?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Is it possible to have the list of down keys?

elect
I see the KeyEvent has a nice getButtonDownCount() and getButtonsDown() but these refer to mouse buttons..

isn't there a way to get the corresponding list of pressed keyboard buttons?
Art
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to have the list of down keys?

Art
You can check out what I did in an open source library here: https://bintray.com/pnnl/maven/svf/view

The relevant code is under gov.pnnl.svf.*.input in svf, svf-awt, and svf-swt.

It essentially just tracks the state of key presses for the view.
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to have the list of down keys?

elect
Could you point me to something more precise?
Art
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to have the list of down keys?

Art
Are you running JOGL in Swing, SWT, NEWT, or JavaFX?
Art
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to have the list of down keys?

Art
Here's the code for the Swing implementation. You just need to add it as key and focus listeners to the Swing panel.

https://github.com/pnnl/svf/blob/master/svf-awt/src/main/java/gov/pnnl/svf/awt/input/AwtInputKeyAdapter.java