FirstName LastName FirstName LastName - 1 year ago 75
Java Question

Want to create mouse clicks on a window with java

I want to create java code which will stimulate a mouse click on any window of a windows OS application - eg browser, word etc.

Can someone suggest how I can begin ? I don't know which API's are needed for this.
I also need to know if this is a very complex task and will require more than just
core concepts of Java.

Thanks in advance.

Answer Source

The class you would want to use for this task is the Robot class:

It may require more knowledge than the core concepts (depending on what you consider core), but Java is a good language to deal with this kind of thing.

Depending on what you seek to do with this knowledge, this may end up a very complex task. For example, if you sought to click on a specific button on the screen, you would need some way to analyze the screen (a very hard task). If you know where every button is already, you just move to the x, y location and cause a click to occur.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download