programming touchpad of laptop

随声附和 提交于 2019-12-08 12:37:20

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/1600860/programming-touchpad-of-laptop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!