< prev index next >

## src/java.desktop/share/classes/javax/swing/DefaultCellEditor.java

Print this page

    rev 48358 : Work in progress for JDK-6303622
    Use generic in Swing components like JComboBox
    1. Added generic return type and parameter type for JComboBox.
    2. Modified JList related classes as well.

    *** 126,144 ****
          }

          /**
           * Constructs a <code>DefaultCellEditor</code> object that uses a
           * combo box.
    !      *
           * @param comboBox  a <code>JComboBox</code> object
           */
    !     public DefaultCellEditor(final JComboBox<?> comboBox) {
              editorComponent = comboBox;
              comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
              delegate = new EditorDelegate() {
                  public void setValue(Object value) {
    !                 comboBox.setSelectedItem(value);
                  }

                  public Object getCellEditorValue() {
                      return comboBox.getSelectedItem();
                  }
    --- 126,145 ----
          }

          /**
           * Constructs a <code>DefaultCellEditor</code> object that uses a
           * combo box.
    !      *@param <E> the type of the elements of comboBox
           * @param comboBox  a <code>JComboBox</code> object
           */
    !     @SuppressWarnings("unchecked")
    !     public <E> DefaultCellEditor(final JComboBox<E> comboBox) {
              editorComponent = comboBox;
              comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
              delegate = new EditorDelegate() {
                  public void setValue(Object value) {
    !                 comboBox.setSelectedItem((E)value);
                  }

                  public Object getCellEditorValue() {
                      return comboBox.getSelectedItem();
                  }

< prev index next >