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

Need API to query states of CAPS LOCK and NUM LOCK keys

    XMLWordPrintable

    Details

      Backports

        Description

        We would like to add a JavaFX API to get the state of CAPS LOCK, NUM LOCK, or SCROLL LOCK.

        AWT already has an API to do this:

        boolean java.awt.ToolKit::getLockingKeyState​(int keyCode)

        https://docs.oracle.com/en/java/javase/15/docs/api/java.desktop/java/awt/Toolkit.html#getLockingKeyState%28int%29

        We need something similar in JavaFX. Among other things, it would allow an application to inform the user that caps lock was enabled for passwords or other usages where the keyboard input might not be echoed. See JDK-8090732.

        A similar FX API would be something like:

        boolean java.application.Platform::isKeyLocked(KeyCode keyCode)

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                kcr Kevin Rushforth
                Reporter:
                shadowbug Shadow Bug
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: