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

Toolkit.getLockingKeyState() does not return Scroll lock state

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Subcomponent:
    • Understanding:
      Fix Understood
    • CPU:
      x86
    • OS:
      linux

      Description

      java version "1.4.1-rc"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-rc-b19)
      Java HotSpot(TM) Client VM (build 1.4.1-rc-b19, mixed mode)

      Calling toolkit.getLockingKeyState(KeyEvent.VK_SCROLL_LOCK) always returns whether the scroll lock key is currently held down, instead of current state of Scroll Lock.

      Try running following sample program; every second it prints the scroll lock state.Try pressing Scroll lock; not that getLockingKeyState only returns true if you are holding scroll lock while it is called, if you press caps lock once (to enable it and release, then you get false back.

      import java.awt.Toolkit;
      import java.awt.event.KeyEvent;

      public class ScrollProb {
        public static void main(String args[]) {
          for (;;) {
            try {
      Thread.sleep(1000);
            } catch(InterruptedException excep) {}
            System.out.println("Scroll lock on? " +
      Toolkit.getDefaultToolkit().getLockingKeyState(
      KeyEvent.VK_SCROLL_LOCK));
          }
        }
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              yan Yuri Nesterenko
              Reporter:
              yuwwang Yu Wang (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Imported:
                Indexed: