How can I keep executing work while a button is pressed?

后端 未结 3 1562
醉话见心
醉话见心 2021-01-13 09:25

I want to keep executing work while a button is pressed, using Java. When the button is released, the work should stop. Something like this:

Button_is_presse         


        
3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-13 09:51

    You may need to use mousePressed event to start the action

    And use mouseReleased event to stop the action (This is neccesary)

    For more information refer here

提交回复
热议问题