4330950: Lost newly entered data in the cell when resizing column width
Reviewed-by: peterz
--- a/jdk/src/share/classes/javax/swing/JTable.java Fri Sep 17 23:16:19 2010 +0400
+++ b/jdk/src/share/classes/javax/swing/JTable.java Fri Sep 17 23:21:51 2010 +0400
@@ -4574,9 +4574,8 @@
* @see TableColumnModelListener
*/
public void columnMoved(TableColumnModelEvent e) {
- // If I'm currently editing, then I should stop editing
- if (isEditing()) {
- removeEditor();
+ if (isEditing() && !getCellEditor().stopCellEditing()) {
+ getCellEditor().cancelCellEditing();
}
repaint();
}
@@ -4593,8 +4592,8 @@
* @see TableColumnModelListener
*/
public void columnMarginChanged(ChangeEvent e) {
- if (isEditing()) {
- removeEditor();
+ if (isEditing() && !getCellEditor().stopCellEditing()) {
+ getCellEditor().cancelCellEditing();
}
TableColumn resizingColumn = getResizingColumn();
// Need to do this here, before the parent's