Answers for "java get mouse click coordinates"

1

java get mouse coordinates

int x =  MouseInfo.getPointerInfo().getLocation().x;
int y = MouseInfo.getPointerInfo().getLocation().y;
Posted by: Guest on January-30-2021
1

java mouselistener get coordinates

implement MouseListener

@Override
public void mouseClicked(MouseEvent e) {
    int x=e.getX();
    int y=e.getY();
    System.out.println(x+","+y);//these co-ords are relative to the component
}
Posted by: Guest on January-13-2021

Code answers related to "java get mouse click coordinates"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language