Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2012
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    java mouse click coordinates [EvenMouselistener]

    Can someone give me a example?

    Basically I need it to link my ad http://eps-world.org/programming/

    I'm not sure what the coordinates are that's the issue.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    PHP Code:
    public void mouseClicked(MouseEvent e)
    {
        
    Point relativeP e.getPoint();
        
    Point absoluteP e.getPointOnScreen();

    Then work with the points. One is relative to the component and the other is absolute.

  • #3
    New Coder
    Join Date
    Jun 2012
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    PHP Code:
    public void mouseClicked(MouseEvent e)
    {
        
    Point relativeP e.getPoint();
        
    Point absoluteP e.getPointOnScreen();

    Then work with the points. One is relative to the component and the other is absolute.
    Could you give me a better example? one that will click a coordinate e.g X=400 Y=400?

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    You mean perform a click, not where it was clicked? You can't do that with a mouse listener. You have to use a robot for that.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •