如何在Swing应用程序中使用后退和前进鼠标按钮? [英] How can I use the back and forward mouse buttons in a Swing application?

查看:106
本文介绍了如何在Swing应用程序中使用后退和前进鼠标按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题很简单。我找不到关于这个问题的很多链接,我找到的那些似乎没有避免真正的问题。我的应用程序必须处理后退和前进鼠标按钮的鼠标按下/释放事件。我该如何处理?

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 the mouse pressed/released events for the back and forward mouse buttons. How can I handle this?

编辑:这是使用 JDK 1.6

推荐答案

检查是否通过调用检测到其他鼠标按钮:

Check if additional mouse buttons are detected by calling:

MouseInfo.getNumberOfButtons();

单击其他按钮时,检查是否触发了MouseEvents。如果是这样, MouseInfo.getButton() 返回?

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

根据 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


这篇关于如何在Swing应用程序中使用后退和前进鼠标按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆