So I am working on creating a bot to automate a process for me, I don't have any problem moving the mouse around and clicking stuff. However, I only want the mouse to be able to move inside of a JPanel. How would this be possible?
Printable View
So I am working on creating a bot to automate a process for me, I don't have any problem moving the mouse around and clicking stuff. However, I only want the mouse to be able to move inside of a JPanel. How would this be possible?
If you only want to move the mouse programmatically within a restricted rectangle, then tell us where you're stuck in this process.
If you want to prevent the user from moving the mouse outside of a defined rectangle, then for this you would require either JNI or JNA to make platform calls. Of necessity any solution would be platform-specific. On a side note, I would not want to be a user of your program to find that my mouse has been restricted to a box.
Also, if you need to find the dimensions of the outside application, then (I believe) you would need to again make platform/OS calls, and again this may require use of JNI or JNA (or some outside library, such as AutoIt if this is Windows).