1

I am having a problem in locating/ or giving correct coordinates for mouse move and then clicking with Java Robot - (Part of testing project) To elaborate: I need to click an object which is at (100,100) on a screen with the resolution say axb. but I need to reuse the same code dynamically for some other screen resolution - Here I need to provide coordinates of the new screen dynamically.. Any help is appreciated

Gopi
  • 11
  • 2
  • what about this http://stackoverflow.com/questions/877570/java-getting-resolutions-of-one-all-available-monitors-instead-of-the-whole-de also I would check dpi calculation for screen – HRgiger Nov 28 '11 at 11:30

1 Answers1

0

The correct approach would be using the Windows API over JNI. When you have the window you chold determine its real position. Based on its position you could calculate the Position of the buttons you'd like to press via java robot api.

e.g.: -> In Java Swing how do you get a Win32 window handle (hwnd) reference to a window?

maybe you should use jna (like described in the link above) instead of jni -> https://github.com/twall/jna#readme

Community
  • 1
  • 1
Alex_M
  • 1,824
  • 1
  • 14
  • 26