Login  Register

Is it possible to have the list of down keys?

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

Is it possible to have the list of down keys?

elect
535 posts
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
| More
Print post
Permalink

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

Art
9 posts
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
| More
Print post
Permalink

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

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

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

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

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

Art
9 posts
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