笔记本电脑触摸板编程

发布于 2024-08-09 01:05:01 字数 189 浏览 8 评论 0原文

我想编写一个程序,可以根据我在触摸板上移动手指的方式来控制光标移动。我希望我的程序获取用户触摸触摸板的位置,然后我想使用我自己的程序控制鼠标移动。我想用 Java 来做这个。我可以用 Java 来做这个吗?我想在 Windows 操作系统上运行它。我的笔记本电脑触摸板设备驱动程序是否提供一些 API,我可以通过这些 API 获取有关用户何时何地触摸触摸板的信息?

I want to write a program which can control my cursor movements depending on the the way I move my finger on the touchpad. I want my program to get the location where the user touched the touchpad, then I want to control mouse movement using my own program. I want do this in Java. Can I do this in Java? I would like to run it on Windows OS. Does my laptops touchpad device driver provide some API by which I can get the info about when and where the user touched the touchpad?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦罢 2024-08-16 01:05:01

想想这种情况。

有人想要退出你的程序。他们触摸触控板。你的程序将光标移动到他们没有预料到的地方。他们感到不安和困惑。

他们继续触摸触控板,您的程序继续执行他们没有预料到的事情。他们发现自己无法控制光标。现在怎么办?

一般来说,让程序移动光标会导致灾难。

  1. 光标很难在屏幕上找到。对对话框进行“光标变形”的 X-windows 应用程序有一个选项可以禁用此功能,因为它很混乱。

  2. 取消用户对光标的控制会使计算机(已经很难使用)变得更难使用,因为有这种“模式”的东西。当你的程序运行时,会发生一件事。当你的程序没有运行时,会发生一些不同的情况。

查看 http://java.sun。 com/j2se/1.4.2/docs/api/java/awt/Cursor.html

似乎没有任何方法可以更改光标的位置。它跟踪鼠标。

但是,请查看 http://java.lang. sun.com/j2se/1.5.0/docs/api/java/awt/Robot.html

它具有合成鼠标事件的能力。随意玩吧。

Think about this situation.

Person wants to exit your program. They touch the trackpad. Your program moves the cursor somewhere they didn't expect. They're upset and confused.

They continue to touch the trackpad, your program continues to do something they didn't expect. They find they're unable to control the cursor. Now what?

Generally, having your program move the cursor is a recipe for disaster.

  1. The cursor is hard enough to spot on the screen. X-windows applications which do "cursor warping" to dialog boxes have an option to disable this because it is confusing.

  2. Removing control of the cursor from the user makes the computer (already very hard to use) much harder to use because there's this "mode" thing. When your program is running, one thing happens. When your program is not running, something different happens.

Look at http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Cursor.html

There do not appear to be any methods to change the cursor's position. It tracks the mouse.

However, look at http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Robot.html

This has the ability to synthesize mouse events. Feel free to play with it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文