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;
  }
 protected void paintEditor(Graphics g) {
   Component component = grid.getEditorComponent();
   if (component == null) {
     return;
   }
   Rectangle cellBounds = grid.getCellBounds(grid.getEditingRow(), grid.getEditingColumn());
   component.setBounds(cellBounds);
   component.validate();
   component.requestFocus();
 }
 public static void setRelativeBounds(
     @NotNull Component parent,
     @NotNull Rectangle bounds,
     @NotNull Component child,
     @NotNull Container validationParent) {
   validationParent.add(parent);
   parent.setBounds(bounds);
   parent.validate();
   child.setLocation(SwingUtilities.convertPoint(child, 0, 0, parent));
   validationParent.remove(parent);
 }
 public static void validate(Component component) {
   if (component instanceof JComponent) ((JComponent) component).revalidate();
   else component.validate();
 }