Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java get mouse coordinates

int x =  MouseInfo.getPointerInfo().getLocation().x;
int y = MouseInfo.getPointerInfo().getLocation().y;
Comment

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
}
Comment

PREVIOUS NEXT
Code Example
Java :: how to get the width and height of a string in java 
Java :: error: cannot find symbol@javax.annotation.Generated( 
Java :: java file dialog 
Java :: java remove List null element 
Java :: How to turn off darkmode for my app in android studio 
Java :: how to install java 8 on aws linux 
Java :: how can I split string according to space in java? 
Java :: how to uppercase the first letter of a string in java 
Java :: array to map java5 
Java :: java random max and min 
Java :: java bufferedimage get int array 
Java :: how to use edittext get 
Java :: guess the number java 
Java :: javafx icon button 
Java :: init cap java 
Java :: Access denied finding property "camera.aux.packagelist" 
Java :: take string array input in java 
Java :: javax.xml.bind does not exist 
Java :: java jtextfield text bold 
Java :: Xlint:deprecation android studio 
Java :: find number of days between two local dates in java 8 
Java :: string array to stream 
Java :: how to write sensor data into file android studio 
Java :: sort array<entry float android studio 
Java :: take string until / 
Java :: spring h2 database dependency 
Java :: java printf leading zeros 
Java :: Get the first Monday of a month in Java 
Java :: how to find smallest number in array java 
Java :: list to observablelistz 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =