Hey guys,
I want to writing a program that clicks. I want to be able to specify the area it clicks. Anyone know how to do this? I googled a bunch and couldn't find anything even close to this.

As in mouse clicks? Look at the Robot class in java.awt, it allows you to move the mouse, click left/right button etc under program control.

Is there another class that will let me click without using the mouse? or is that the only way

I don't understand what you mean. A "click" is a thing you do with a mouse. Robot simulates you moving the mouse and clicking it, so you don't use your physical mouse. Maybe you can explain in a bit more detail what you want?

Okay so my friend hosts a free mmo on his home computer. I want to write a program so that when the players load up his patcher program (which is in java) he wants it to automatically click a link on the website which is built into the patcher client.

I want it to click the link (it adds a vote to a webpage which ranks his server) but I don't want to move the mouse around. (nothing happens except the vote is cast and that's all within the patcher.

I dont want to use the mouse movement thing because everyone uses different resolutions.

you could probably use "Selenium" to do this for you. it is used more for testing purposes, but it'll do what you want.

Let me check my understanding... your friend wants his program to subvert the user's computer to register a vote in his favour without the user being aware that anything has happened? If that's the case then I think he's writing malware, so you (and I) should have nothing to do with it. At the very least it should pop up a dialog asking "Do you want to register a vote for the xxx server?".
Apologies if I have misunderstood this.

@James, the button says "VOTE & PLAY" to launch the game its required that you vote for their server if you want to play. This is a way of keeping their players from being lazy, cause they obviously like the server enough to play on it and they are just to lazy to vote, this brings the voting to them.

btw this is not malware. It is not malicious in anyway towards the user or their computer.

anyway if you don't want to help me thats fine. I will find someone else who can. there has got to be someway of doing this.

hi PhiberOptik. Like I said "Apologies if I have misunderstood this". The message you have now described is exactly the kind of thing I was asking for, so I'm now completely happy that this is OK. I was just being cautious.
I'd like to help if I can, but the Robot class is the only thing I know of in standard Java that will do what you want. You can get the current mouse position, move the mouse to the thing you want to click, click it, then move the mouse back to where it started, so the user won't be confused or inconvenienced.
James

This article has been dead for over six months. Start a new discussion instead.