File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes  click the mouse in a coordinate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark " click the mouse in a coordinate" Watch " click the mouse in a coordinate" New topic
Author

click the mouse in a coordinate

alona ariel
Ranch Hand

Joined: Sep 09, 2008
Posts: 36
Is it possible to click the mouse in a coordinate, so it give the x,y horizontal with regard to the (0,0) point?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

Define where (0,0) is. Is it the screen? The window? The parent control?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Hauke Ingmar Schmidt
Rancher

Joined: Nov 18, 2008
Posts: 433
    
    2
I am not quite sure what you want to achieve. Do you want to simulate a mouse click programmatically? Then have a look at java.awt.Robot.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2203
    
    7
Is it possible to click the mouse in a coordinate, so it give the x,y horizontal with regard to the (0,0) point?


That is exactly what the mouse point is. It is a point relative to the (0, 0) of the component you added the mouse listener to.

If you want the point relative to some other component then you can look at the SwingUtilities class for the "convert..." methods.
 
 
subject: click the mouse in a coordinate