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

Cannot mix FocusManager.setFocusManager and JComponent.setNextFocusableComponent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.4.0, 5.0
    • client-libs
    • beta2
    • generic, x86
    • generic, windows_2000

      Because the new implementations of DefaultFocusManager and
      setNextFocusableComponent are designed to cope with mixed 1.4/pre-1.4
      environments, they will defer some of their operations to other objects if they
      detect such an environment. Unfortunately, mixing of these two APIs makes the
      new code think that it is operating in such an environment when it really isn't.
      Because an instance of HardCodedFocusTraversalPolicy is interposed between the
      DFM and the LegacyGlueFocusTraversalPolicy, the DFM doesn't notice that the
      environment is pure legacy. The code eventually goes into an infinite loop and
      generates a StackOverflowException. Here is a portion of the stack trace:

      java.lang.StackOverflowError
              at
      javax.swing.LegacyGlueFocusTraversalPolicy.getLastComponent(DefaultFoc
      usManager.java:156)
              at
      javax.swing.HardCodedFocusTraversalPolicy.getLastComponent(HardCodedFo
      cusTraversalPolicy.java:109)
              at
      javax.swing.DefaultFocusManager.getLastComponent(DefaultFocusManager.j
      ava:118)
              at
      javax.swing.LegacyGlueFocusTraversalPolicy.getLastComponent(DefaultFoc
      usManager.java:156)
              at
      javax.swing.HardCodedFocusTraversalPolicy.getLastComponent(HardCodedFo
      cusTraversalPolicy.java:109)
              at
      javax.swing.DefaultFocusManager.getLastComponent(DefaultFocusManager.j
      ava:118)
      [...]

            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: