How to simulate a real mouse click using java?

前端 未结 6 1639
清酒与你
清酒与你 2020-11-27 14:44

I\'m attempting to perform a mouse click in Java, to click something in an external program. To do this, I\'m using java.awt.robot, and the following code:

6条回答
  •  野性不改
    2020-11-27 15:37

    FYI, in newer versions of Windows, there's a new setting where if a program is running in Adminstrator mode, then another program not in administrator mode, cannot send any clicks or other input events to it. Check your source program to which you are trying to send the click (right click -> properties), and see if the 'run as administrator' checkbox is selected.

提交回复
热议问题