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

Editing and pressing enter on editable combobox sets the value to blank

XMLWordPrintable

      In ETL Studio, display a property sheet on a table and goto the columns tab. In the columns tab, add a new column. Tab to the informat or format column. Press F2 to start editing. Change the informat/format to $5. Press enter to save the change. Input focus leaves table (see S0197237). Press shift-tab to move input focus to table again. Press F2 to start editing again. Press enter to stop editing. The value is changed to nothing. The value should not
      be changed.

      This appears to be a Sun bug. In 1.4.1 in javax.swing.plaf.basic.BasicComboBoxUI about line 1459 in the EnterAction internal class is the following code:
      if ( ui.isTableCellEditor() ) {
      // Forces the selection of the list item if the
      // combo box is in a JTable.
      comboBox.setSelectedIndex(ui.popup.getList().getSelectedIndex
      ());
      }
      The problem is the selected index is -1 indicating none of the values in the popup list are selected. This code should not be setting the selected index!

      Tried this with 1.5 still happens. The above code is still there pretty much as is. Don't know why I didn't send this to JRE.WIN earlier. Low priority but annoying. Also, I don't know how I can make it work.

            Unassigned Unassigned
            elarsen Erik Larsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: