File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes mouse related Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "mouse related" Watch "mouse related" New topic

mouse related

Amit Bathla
Ranch Hand

Joined: Feb 11, 2005
Posts: 51
we know that we can get co-ordinates of mouse pointer
through functions in
int a=getX();(for getting x co.)
similarly i wanna know that can we set mouse pointer to particular point
via any function call.please help me.

we know that when we press mouse button certain event is generaated which is passed to operating system .
simillarly can we generate that event by ourself(expl), that is without clicking the mouse but generating that event.
help me to solve my problems
thanks in advance

University of Florida
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
Look at the java.awt.Robot class. It has methods to move the mouse, generate mouse and keyboard events, move the mouse around, screen capture, etc...
Shyam Prasad Murarka
Ranch Hand

Joined: May 02, 2005
Posts: 209
Dear Steven,
While you posted this reply I was going through MouseEvent's API. I came across a method translatePoint(int x, int y). What is it used for? I didn't understand what they explained. It sounded something like changing the mouse position. Please explain.

With Best Regards,
Shyam Prasad Murarka
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

It just changes the x and y values that will be returned by getX() and getY(). It doesn't move the mouse pointer.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: mouse related
It's not a secret anymore!