How can I use the back and forward mouse buttons in a Swing application?

后端 未结 4 1398
南旧
南旧 2021-01-12 05:17

The question is pretty simple. I couldn\'t find many links regarding this issue, and the ones I found didn\'t seemed to avoid the real question. My application must handle t

4条回答
  •  离开以前
    2021-01-12 05:22

    Check if additional mouse buttons are detected by calling:

    MouseInfo.getNumberOfButtons();

    Check if MouseEvents are fired when you click those additional buttons. If so, what does MouseInfo.getButton() return?

    According to the javadocs for MouseInfo.getButton():

    If a mouse with five buttons is installed, this method may return the following values:

    * 0 (NOBUTTON)
    * 1 (BUTTON1)
    * 2 (BUTTON2)
    * 3 (BUTTON3)
    * 4
    * 5
    

提交回复
热议问题