0

Button and HAT presses in JInput is based on events, meaning if I press Button 1, it will only fire once while I'm holding it down and once again when I release the button. I want to make it so that if I have the button held down, it will still keep calling the method I assigned to it. How do I do this>

Propeller
  • 2,465
  • 6
  • 35
  • 49

1 Answers1

0

Okay so I did some research and eventually ended up with the following which solved it for me:

    myTimer = new Timer();
    myTimer.schedule(new TimerTask() {
        @Override
        public void run() {
            // Do stuff
        }
    }, 50, 50);

Then I call the following on another method when I need to stop the timer.

    myTimer.cancel;
    myTimer.purge;
Propeller
  • 2,465
  • 6
  • 35
  • 49