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 setting the cursor position Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "setting the cursor position" Watch "setting the cursor position" New topic

setting the cursor position

niklas aronsson

Joined: Dec 04, 2002
Posts: 7
How can I write to the cursor position without
generating mouse events?
I have tried using the Robot-class, which can generate mouse events, but if there are queued mouse movement events, I have problems detecting
which event not to process.
Is it perhaps possible to let my mouseMoved()-method force an mouse move event to be processed
before those in the queue?
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Just requestFocus() for the component that you want.
Or are you trying to accomplish something else?

"JavaRanch, where the deer and the Certified play" - David O'Meara
niklas aronsson

Joined: Dec 04, 2002
Posts: 7
I want to set the cursor position!
It is possible to do so with the Robot-class method: moveMouse( x,y), but it generates AWT-events.
I have found a way to get around the event-problems, so I'll settle for using the Robot-class, since I now assume there isn't any way to directly setting the cursor position.
I agree. Here's the link:
subject: setting the cursor position
It's not a secret anymore!