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

Editable Combobox and Focus Traversal Policy do not work work together

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.5.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
      Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP, Windows 2000, Windows 95

      A DESCRIPTION OF THE PROBLEM :
      If you write your own Focus Traversal Policy and use it with an editable Combobox the Object wich is passed by the parameter of the methods getComponentAfter or getComponentBefore is not an combobox. It is an Object called: javax.swing.plaf.basic.BasicComboboxEditor. Very strange, because this class is not derived from Component but is passed through it.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Wrote an class derived from DefaultFocusTraversalPolicy and implement the methode getComponentAfter as follows:

      public Component getCompoentAfter(Container root, Component component)
      {
        System.out.println(component):
      }

      Same prcedure for getComponentBefore!

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      javax.swing.Combobox[...]

      ACTUAL -
      javax.swing.plaf.basic.BasicComboboxEditor$BorderlessTextField[...]


      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      public Component getComponentAfter(Container root, Component component)
      {
        if (component.toString().substring(0,42).equals("javax.swing.plaf.basic.BasicComboboxEditor"))
        {
          component = component.getParent();
        }

        ... <your code> ...
      }
      ###@###.### 2004-12-08 16:48:01 GMT

            Unassigned Unassigned
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: