简体   繁体   中英

How to detect more than 3 mouse buttons in Java (Swing)?

除了常规的3个按钮外,我的鼠标还有一个后退和前进按钮-如何在Java中检测是否按下了这两个按钮之一

java.awt.MouseInfo.getNumberOfButtons();

Taken from this site . Since Swing uses AWT under the hood, don't let that awt part bother you.

According to this , the ability for Java to detect any mouse button other than right, left, and middle click was added in Java 7. In all previous versions, you can't. :-(

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM