Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8143597

Provide public API to access current mouse pointer location

    XMLWordPrintable

Details

    • x86
    • other

    Description

      A DESCRIPTION OF THE REQUEST :
      Up to now, no public API is available to access the current mouse pointer location (when the mouse it not moved). There is a workaround using java.awt.MouseInfo.getPointerLocation(), which does not work for Mac:

      PointerInfo pi = MouseInfo.getPointerInfo();
      java.awt.Point mp = pi.getLocation();

      On Mac there is the following workaround using com.sun.glass.ui.Robot, which is not public API:

      com.sun.glass.ui.Robot robot = com.sun.glass.ui.Application
      .GetApplication().createRobot();
      Point mp = new Point(robot.getMouseX(), robot.getMouseY());

      There is no direct means to obtain the current pointer location through JavaFX public API.

      JUSTIFICATION :
      There is no direct means to retrieve the current mouse pointer location via public API of JavaFX. The workaround for Mac relies on accessing JDK internal API, so that this workaround will no longer work with Jigsaw:

       -> com.sun.glass.ui.Application JDK internal API (javafx.graphics)
            -> com.sun.glass.ui.Robot JDK internal API (javafx.graphics)


      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: