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

4

1 回答 1

0

正确的方法是在 JNI 上使用 Windows API。当您拥有窗口时,您可以确定它的实际位置。根据它的位置,您可以通过 java 机器人 api 计算您想要按下的按钮的位置。

例如: ->在 Java Swing 中,如何获得对窗口的 Win32 窗口句柄 (hwnd) 引用?

也许您应该使用 jna(如上面链接中所述)而不是 jni -> https://github.com/twall/jna#readme

于 2011-11-28T11:38:38.033 回答