Comments (6)
Not sure I completely understand what you are asking, but the library itself uses java Robot underneath by default, which is also replacable by anything else.
If you need to press any mouse button, then usual Robot mouse API will be sufficient, the library does not have a wrapper for mouse buttons as it only addresses movement.
from naturalmousemotion.
Thank you @JoonasVali
I tried to use the standard robot function to simulate the click but then the mouse goes back to the previous location where i used the robot. So after each use of naturalmouse i have to call the move function of the robot
I guess that i am doing something wrong
from naturalmousemotion.
Hmm, that sounds wrong. I've never seen Robot behaving like that. I would search for logic mistakes in the code. A click should not affect position at all.
The code for a click should look something like that
robot.mousePress(InputEvent.BUTTON1_MASK);
Thread.sleep((int)(Math.random * 20))
robot.mouseRelease(InputEvent.BUTTON1_MASK);
If the issue persists, can you try set the Robot to the MouseMotionFactory and use that same Robot for clicking and see if it makes any difference?
This should look something like:
MouseMotionNature nature = factory.getNature();
SystemCalls systemCalls = new DefaultSystemCalls(myRobot);
nature.setSystemCalls(systemCalls);
from naturalmousemotion.
Your solution works !
In the mouse handler constructor i added
MouseMotionNature nature = mouseFactory.getNature();
SystemCalls systemCalls = new DefaultSystemCalls(robot);
nature.setSystemCalls(systemCalls);
mouseFactory.setNature(nature);
Thank you
from naturalmousemotion.
Good to know. I think this is something I haven't yet faced and maybe a larger issue in hiding. Thanks.
from naturalmousemotion.
In case of : Mac OS 10.14 with Java 13
from naturalmousemotion.
Related Issues (9)
- Feature request to restrict mouse movement HOT 4
- Would there be a way to cancel the attempt to 'repopulate the movement array'? HOT 15
- are there plans to provide the algorithm as a c/c++ library HOT 3
- Can you provide the c++ version HOT 2
- How to set the time when the mouse slides to reach the target point? HOT 1
- Screen limits cause problems with multiple monitors HOT 1
- Hello, the mouse is in the automatic slide, is there an API to stop sliding? HOT 3
- IF mouse goes off canvas errors occur HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from naturalmousemotion.