Java鼠标事件右键单击


87

在我的三个按钮上,鼠标MouseEvent.BUTTON2=中键单击和MouseEvent.BUTTON3=右键单击。

两键鼠标就是这种情况吗?

谢谢

Answers:


170

为了避免任何歧义,请使用SwingUtilities中的实用程序方法:

SwingUtilities.isLeftMouseButton(MouseEvent anEvent) SwingUtilities.isRightMouseButton(MouseEvent anEvent) SwingUtilities.isMiddleMouseButton(MouseEvent anEvent)



By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.