public boolean editCellAt(final int row, final int column, final EventObject e) { if (cellEditor != null && !cellEditor.stopCellEditing()) { return false; } if (row < 0 || row >= getRowCount() || column < 0 || column >= getColumnCount()) { return false; } if (!isCellEditable(row, column)) { return false; } if (myEditorRemover == null) { final KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); myEditorRemover = new MyCellEditorRemover(); //noinspection HardCodedStringLiteral keyboardFocusManager.addPropertyChangeListener("focusOwner", myEditorRemover); //noinspection HardCodedStringLiteral keyboardFocusManager.addPropertyChangeListener("permanentFocusOwner", myEditorRemover); } final TableCellEditor editor = getCellEditor(row, column); if (editor != null && editor.isCellEditable(e)) { editorComp = prepareEditor(editor, row, column); // ((JComponent)editorComp).setBorder(null); if (editorComp == null) { removeEditor(); return false; } editorComp.setBounds(getCellRect(row, column, false)); add(editorComp); editorComp.validate(); IdeFocusManager.findInstanceByComponent(this).requestFocus(editorComp, false); setCellEditor(editor); setEditingRow(row); setEditingColumn(column); editor.addCellEditorListener(this); if (isTypeAhead) { JTableCellEditorHelper.typeAhead(this, e, row, column); } return true; } return false; }
public boolean isCellEditable(EventObject anEvent) { selectEditor((MouseEvent) anEvent); return editor.isCellEditable(anEvent); }