# How to control gain between mouse movement and cursor movement ?

• March 9th, 2012, 07:44 AM
DrPete
How to control gain between mouse movement and cursor movement ?
Hello, I want to control the gain between the mouse and the cursor in Java using XP.

For example, I want to be able to make the cursor move 10 pix when the mouse moves x cm (where x could be 2 cm, or 10 cm, or 20 cm, etc.). I want to use a simple parameter, a multiplier, to do this. I can find the value of the parameter empirically (I can move the mouse x cm and play around with the parameter value until I get the 10 pix of cursor movement).

I know how to:

- switch off the Windows mouse accelerator so that the relation between mouse movement and cursor movement is linear.

I don't know how to:

- access the mouse position data in the registry (?) and then feed that to the Java cursor via a variable/parameter/multiplier.

Thanks in advance for any replies
• March 9th, 2012, 01:37 PM
Norm
Re: How to control gain between mouse movement and cursor movement ?
What is the difference between the mouse movements and the cursor movements?
People often use both terms for the same thing, what I call the cursor.
There is no way for a PC to move the mouse that a user has in his hand.

Java has no way to go into the Control panel and change OS settings.
• March 12th, 2012, 07:03 AM
DrPete
Re: How to control gain between mouse movement and cursor movement ?

"What is the difference between the mouse movements and the cursor movements?"

The mouse is what I move with my hand, the cursor is what I see moving on the computer screen. Java must read the mouse position and use this information to position the cursor. For example, if the mouse moves x cm, Java reads this and moves the cursor y pixels. Now, what I want to do is to control the relation between x and y.

Let's consider only the horizontal component of the movement and suppose that the relation that Java uses is:

cursorposition = k*mouseposition, where k is a constant.

I want to be able to change k, so that a mouse movement of x cm no longer produces a cursor movement of y pix. For example, I may want to produce a cursor movement of z pix, where z=l*y. Then I want to be able to implement this relation:

cursorposition = l*k*mouseposition.

I hope this clarifies things.
• March 12th, 2012, 07:27 AM
KevinWorkman
Re: How to control gain between mouse movement and cursor movement ?
I don't think you can do that with pure Java, at least not as you described it. You could use a combination of a MouseListener and the Robot class to get the appearance of something similar though.