Component (final JTable table, Object value, boolean isSelected, final int row, int column) { final JPanel p = new JPanel(new BorderLayout()) { @Override public void addNotify() { super.addNotify(); validate(); int height = getPreferredSize().height; if (height > table.getRowHeight(row)) { myRowResizeAnimator.resize(row, height); } } @Override public void removeNotify() { if (myCellEditor != null) myCellEditor.saveFocusIndex(); super.removeNotify(); myRowResizeAnimator.resize(row, table.getRowHeight()); } }; p.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { IdeFocusManager focusManager = IdeFocusManager.findInstanceByComponent(p); focusManager.requestFocus(getComponentToFocus(), true); } private Component getComponentToFocus() { if (myLastFocusedEditorComponentIdx >= 0) { JComponent[] focusableComponents = myEditor.getFocusableComponents(); if (myLastFocusedEditorComponentIdx < focusableComponents.length) { return focusableComponents[myLastFocusedEditorComponentIdx]; } } return myEditor.getPreferredFocusedComponent(); } }); p.add(myEditor, BorderLayout.CENTER); return p; }