I want a program to be able to give me x and y coordinates for my mouse outside of any frame or panel. Is that even possible? I would also like to now if it's possible to kinda read the screen as an image for input? I want to make a program that interacts with the screen, so far I kinda know how to use the Robot class, but I still need to be able to use the screen as an input for my program. Please tell me if this is possible, and if you can help, that would be great!
Asked
Active
Viewed 299 times
1 Answers
0
You can poll the MouseInfo
for information about the state of the mouse, something like...
Point point = MouseInfo.getPointerInfo().getLocation();
As an example...
There is no way to register a callback to get this information, like you can with the MouseListener
, you will need to create your own Thread
and poll this class manually...assuming you want continuous feedback...
For example...

Community
- 1
- 1

MadProgrammer
- 343,457
- 22
- 230
- 366
-
It is possible to simply to make a timer with a short delay and constantly call that, that works fine. Thanks a lot! – Ofek Gila Oct 17 '14 at 06:25
-
@OfekGila The main point is to put it somewhere out side of the Event Dispatching Thread ;) – MadProgrammer Oct 17 '14 at 06:42