
import java.awt.*;
class GetPointerLoc
{
public static void main(String args[])
{
// Get global current cursor location
Point p=MouseInfo.getPointerInfo().getLocation();
System.out.println(p);
}
}
getLocation(): This method is present in the java.awt.PointerInfo class. The object for this class can be created using the getPointerInfo() method in the java.awt.MouseInfo class.
Image credit: Iconarchive
No comments:
Post a Comment