0

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!

Ofek Gila
  • 693
  • 1
  • 10
  • 21

1 Answers1

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