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

Setting a DelegatingDefaultFocusManager as the current FocusManager fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.4.0
    • client-libs
    • None
    • beta2
    • generic
    • generic
    • Verified

      You can reproduce this bug by calling:

        FocusManager.setCurrentManager(FocusManager.getCurrentManager());
        
      This will install an instance of DelegatingDefaultFocusManager as the
      current KeyboardFocusManager. This FM delegates all of its functionality to
      a wrapped KFM. However, because a KFM needs to be installed as the current
      KFM in order to call the protected functions which query the global focus
      state, the AWT starts throwing SecurityExceptions for all common focus
      operations. Here's is one possible exception trace:

      java.lang.SecurityException: this KeyboardFocusManager is not installed
      in the current thread's context
              at
      java.awt.KeyboardFocusManager.getGlobalFocusedWindow(KeyboardFocusMan
      ager.java:622)
              at
      java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFoc
      usManager.java:457)
              at
      javax.swing.DelegatingDefaultFocusManager.dispatchEvent(FocusManager.
      java:235)
              at java.awt.Component.dispatchEventImpl(Component.java:3383)
              at java.awt.Container.dispatchEventImpl(Container.java:1440)
              at java.awt.Window.dispatchEventImpl(Window.java:1531)
              at java.awt.Component.dispatchEvent(Component.java:3353)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:439)
              at java.awt.SequencedEvent.dispatch(SequencedEvent.java:96)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:437)
              at
      java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:15
      0)
              at
      java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
              at
      java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:131)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)

            dmendenhsunw David Mendenhall (Inactive)
            dmendenhsunw David Mendenhall (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: