File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mouse related

 
Amit Bathla
Ranch Hand
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
first:
we know that we can get co-ordinates of mouse pointer
through functions in
like
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.

second:
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
bye
 
Steven Bell
Ranch Hand
Posts: 1071
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 209
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It just changes the x and y values that will be returned by getX() and getY(). It doesn't move the mouse pointer.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic