How can i handle events on a Joystick? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i handle events on a Joystick?

The controller is detectable, can even print out the "getName()" of each component. I want certain/ specific events to occure when a button is pressed or released..

11th Feb 2020, 12:20 AM
Kosine
Kosine - avatar
4 Answers
+ 2
I believe you are looking for the Event Container and multiple buttons similar to the construction I found via stackoverflow... not to be misconstrued with the Javascript set up. The user asking actually has a nicely structured Java code and just needed a simple fix. https://codereview.stackexchange.com/questions/203642/event-handling-gamepad-in-java
11th Feb 2020, 1:10 AM
BroFar
BroFar - avatar
+ 1
Are you working with swing or javaFX?
11th Feb 2020, 12:49 AM
Denise Roßberg
Denise Roßberg - avatar
+ 1
tutorial about event handling: https://www.tutorialspoint.com/swing/swing_event_handling.htm stackoverflow question about joystick events in java https://stackoverflow.com/questions/31279716/joystick-event-in-java Hope this helps :)
11th Feb 2020, 2:08 AM
Denise Roßberg
Denise Roßberg - avatar
0
Working with java swing
11th Feb 2020, 1:38 AM
Kosine
Kosine - avatar