views:

352

answers:

1

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?

+3  A: 

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.

S.Lott