4330950: Lost newly entered data in the cell when resizing column width

Reviewed-by: peterz
This commit is contained in:
Alexander Potochkin 2010-09-17 23:21:51 +04:00
parent 76501ba258
commit 1c45f6db9e

View File

@ -4574,9 +4574,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
* @see TableColumnModelListener * @see TableColumnModelListener
*/ */
public void columnMoved(TableColumnModelEvent e) { public void columnMoved(TableColumnModelEvent e) {
// If I'm currently editing, then I should stop editing if (isEditing() && !getCellEditor().stopCellEditing()) {
if (isEditing()) { getCellEditor().cancelCellEditing();
removeEditor();
} }
repaint(); repaint();
} }
@ -4593,8 +4592,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
* @see TableColumnModelListener * @see TableColumnModelListener
*/ */
public void columnMarginChanged(ChangeEvent e) { public void columnMarginChanged(ChangeEvent e) {
if (isEditing()) { if (isEditing() && !getCellEditor().stopCellEditing()) {
removeEditor(); getCellEditor().cancelCellEditing();
} }
TableColumn resizingColumn = getResizingColumn(); TableColumn resizingColumn = getResizingColumn();
// Need to do this here, before the parent's // Need to do this here, before the parent's