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 void actionPerformed(ActionEvent e) { JGrid grid = (JGrid) e.getSource(); if (!grid.hasFocus()) { CellEditor cellEditor = grid.getCurrentCellEditor(); if (cellEditor != null && !cellEditor.stopCellEditing()) { return; } grid.requestFocus(); } SelectionModel selectionModel = grid.getSelectionModel(); int anchorRow = selectionModel.getAnchorRow(); int anchorColumn = selectionModel.getAnchorColumn(); grid.editCellAt(anchorRow, anchorColumn, null); Component editorComp = grid.getEditorComponent(); if (editorComp != null) { editorComp.requestFocus(); } }