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

Add to the BasicComboBoxEditor an ability to edit other objects than String

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 7
    • client-libs

      BasicComboBoxEditor has code in the getItem() method, which allows to edit not only Strings, but with the two conditions:
      1. The edited objects must have the public void valueOf(String) method.
      2. Developer must call setSelectedItem() for the combo box model BEFORE user types something in a editable combo box.

      Such behavior is not documented at all. I suggest:
      1. Add public method setEditedObjectClass(Class klass) which will allow to avoid obligatory setSelectedItem() call.
      2. Document requirements to the class, objects of which will be edited (a note about the valueOf() method).

      Maybe the described behavior will be implemented within the RFE of generalizing Swing.
      The 6455449 RFE (Allow user to select non-String items in editable JComboBox, typing their toString() representation) is another way to edit other objects than String.

            alexsch Alexandr Scherbatiy
            mlapshin Mikhail Lapshin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: