java - Java - 检测鼠标是否在屏幕上的任何位置按下
问题描述
我希望我的程序检测鼠标是否在屏幕上的任何位置按下,而不仅仅是程序窗口。它还应该检测鼠标何时被释放。在 Java 中是否可以在我的程序窗口之外检测到这一点?
解决方案
java.awt.event.MouseMotionListener is only going to give you information about mouse movement inside your application window. For events that occur outside that window, there is no way around MouseInfo.getPointerInfo. This is a duplicate of Java mouse motion anywhere on screen.
推荐阅读
- ruby - 帽子流产了!rbenv:捆绑:找不到命令
- python - Google 刷新访问令牌(离线访问)api 中的“unsupported_grant_type”
- c++ - Visual Studio 2017:找不到 v142 的构建工具错误,即使平台工具集设置为 v141
- linux - 使用命令输出(带空格)作为其他命令输入(BASH)
- ios - 为什么我的 collectionView 中的标签小于给定的 dimesinsons
- python - 如何将参数传递给 QueryDicts 并将其连续传递给要在其中使用的 django 表单
- javascript - 获取完整的十六进制整数
- javascript - Jquery animate 不适用于变换属性
- couchdb - 视图上的 CouchDB 键查询比 _all_docs 上的键查询慢得多
- ios - CustomImageView 上的渐变层