I'm trying to make an app that will memorize 1 point on the screen and continuously click that point (running on a timer) until it is manually stopped.

I've noticed that the mouse functions require you to be "inside" a component for it to recognize the mouse position or do any of the sort -- I'm sure there's an expert out there that knows how to avoid something like this.

Anyone have any suggestions or is Java the wrong way to go about this?

Member Avatar for harsh2327

I don't know hot to do it with Java, but you could use AutoHotKey for such programs. This programming language is meant for such stuff. Your code for such a task will be not more than 5 lines

Yep. Ive used it before. I was just wondering if there was a way to do it in java without having a JFrame open in order for it to recognizes a component.

Take a look at the Robot class.

commented: thaks! +2

You are the man Ezzaral. Any time I try to do something unconventional with java, you always have an answer :).

I will try this out now!

I noticed that the Robot class gives you functions to move and click the mouse. Is there a way to get the position the mouse is currently in or am I missing something? Remember, im talking about on the actual desktop/not while hovering over a component so a mouse input listener, i believe wouldnt work.

Thanks.

Got it. Just a little more research and I found this:

Point mPoint = MouseInfo.getPointerInfo().getLocation();

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.