Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4748359

Click in JTableHeader cancels Cell Editor changes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.1
    • client-libs

      Name: jk109818 Date: 09/16/2002


      FULL PRODUCT VERSION :
      java version "1.4.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
      Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)

      AND

      java version "1.4.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
      Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      In the following sample, if you have started to edit a cell
      in a JTable and then click somewhere in the JTableHeader,
      the contents of the cell are lost as the cell editor is
      cancelled.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Start the sample program
      2. double click in any cell
      3. type some text
      4. click anywhere in the table header.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      I would expect the cell editor to stop editing and the value
      entered to remain in the cell. Instead, the cell editor is
      cancelled and any text entered is lost.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import javax.swing.table.*;
      import java.awt.*;
      import java.awt.event.*;

      public class TableTest
      {
          public static void main( String[] args )
          {
              try
              {
                  final JTable table = new JTable( 20, 20 );

                  JFrame frame = new JFrame();
                  JScrollPane scroll = new JScrollPane();
                  scroll.setViewportView( table );
                  frame.getContentPane().add( scroll, BorderLayout.CENTER );
                  frame.pack();
                  frame.addWindowListener(new WindowAdapter() {
                      public void windowClosing(WindowEvent e) {
                          System.exit(0);
                      }
                  });
                  

                  frame.show();
              }
              catch ( Exception e )
              {
                  e.printStackTrace();
              }
          }
      }

      ---------- END SOURCE ----------
      (Review ID: 164568)
      ======================================================================

            shickeysunw Shannon Hickey (Inactive)
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: