Jump to content

simulating mouse movement in java

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
ViZon

ViZon

    Newbie

  • Members
  • Pip
  • 3 posts
i want to simulate mouse movement in java but in such a way that i can control the dots moved by my mouse and not the pixels on the screen like the class Robot can do.
So if i change my sensitivity and move 400 dots the pixels my mouse moved should be different then before i changed my sensitivtiy
anyone has an idea how do do that?
tnx in advance

#2
Sinipull

Sinipull

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 386 posts
What kind of dots are you talking about?
Mouse moves on pixels.

#3
Deadlock

Deadlock

    Learning Programmer

  • Members
  • PipPipPip
  • 81 posts
He means DPI I think. If so, you can write a simple math equation to divide the resolution in which the code will run on by your current resolution(the one you are currently working on) and multiply the result by your desired moving pixel

eg: My computer resolution is 800x600
eg: Another computer resoltion is 1024x796

Say i want to move the mouse 100 pixels,50 pixels on my 800x600..Its will be simple because i won't need the equation, But what if i want to move it on the other computer which has 1024x796 monitor. I will simple do that equation

(1024/800)*100 for x-axis
(600/796)*50 for y-axis