aspose 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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 19541
    
  16

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: 371
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: 2090
    
    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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: click the mouse in a coordinate
 
Similar Threads
UI chain of responsibility vs concrete events
mouse click event for 3D coordinates in java
Displaying a DIV wherever the mouse location is
How can i use mouse to click on an image and draw a point after i clicked ?
Mouse pointer outside of application window issue