4330950: Lost newly entered data in the cell when resizing column width
authoralexp
Fri, 17 Sep 2010 23:21:51 +0400
changeset 6651 f3f6465a128e
parent 6650 9fccd23d7199
child 6652 482a7a13ef22
4330950: Lost newly entered data in the cell when resizing column width Reviewed-by: peterz
jdk/src/share/classes/javax/swing/JTable.java
--- 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