public boolean editCellAt(int index, EventObject e) {
    if (editor != null && !editor.stopCellEditing()) return false;

    if (index < 0 || index >= getModel().getSize()) return false;

    if (!isCellEditable(index)) return false;

    if (editorRemover == null) {
      KeyboardFocusManager fm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
      editorRemover = new CellEditorRemover(fm);
      fm.addPropertyChangeListener("permanentFocusOwner", editorRemover); // NOI18N
    }

    if (editor != null && editor.isCellEditable(e)) {
      editorComp = prepareEditor(index);
      if (editorComp == null) {
        removeEditor();
        return false;
      }
      editorComp.setBounds(getCellBounds(index, index));
      add(editorComp);
      editorComp.validate();

      editingIndex = index;
      editor.addCellEditorListener(this);

      return true;
    }
    return false;
  }
 public void editingStopped(ChangeEvent e) {
   if (editor != null) {
     Object value = editor.getCellEditorValue();
     setValueAt(value, editingIndex);
     removeEditor();
   }
 }
 public Component prepareEditor(int index) {
   Object value = getModel().getElementAt(index);
   boolean isSelected = isSelectedIndex(index);
   Component comp = editor.getListCellEditorComponent(this, value, isSelected, index);
   if (comp instanceof JComponent) {
     JComponent jComp = (JComponent) comp;
     if (jComp.getNextFocusableComponent() == null) {
       jComp.setNextFocusableComponent(this);
     }
   }
   return comp;
 }
  public void removeEditor() {
    KeyboardFocusManager.getCurrentKeyboardFocusManager()
        .removePropertyChangeListener("permanentFocusOwner", editorRemover); // NOI18N
    editorRemover = null;

    if (editor != null) {
      editor.removeCellEditorListener(this);

      if (editorComp != null) {
        remove(editorComp);
      }

      Rectangle cellRect = getCellBounds(editingIndex, editingIndex);

      editingIndex = -1;
      editorComp = null;

      repaint(cellRect);
    }
  }