Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

click the mouse in a coordinate

 
alona ariel
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Define where (0,0) is. Is it the screen? The window? The parent control?
 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2564
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic