JDK-4409947 : Clicking on JTable header triggers editingCancelled event instead of editingStop
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2001-01-31
  • Updated: 2001-07-19
  • Resolved: 2001-07-19
Related Reports
Duplicate :  
Description

Name: yyT116575			Date: 01/30/2001


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

Steps to reproduce the problem:
1. Execute the following code to setup a JTable

import javax.swing.*;
import java.awt.*;
import java.util.*;

public class jtableproblem {
  public static void main (String args[]) {
    Vector rowValues = new Vector();
    Vector r1 = new Vector(); r1.add("0"); r1.add("1");
    rowValues.add(r1);
    Vector colNames = new Vector();
    colNames.add("col 0"); colNames.add("col 1");
    JTable tab = new JTable(rowValues, colNames);
    tab.setPreferredScrollableViewportSize(new Dimension(500,70));
    JFrame f = new JFrame();
    f.getContentPane().add(new JScrollPane(tab));
    f.pack();
    f.setVisible(true);
  }
}

Once the code is executing, begin an editing session by double clicking in a
cell. When inline editing has begun, change the value of the cell. Now, click on
the cell header, you will notice that the edited value has reverted to the
original value by cancelling the editing session instead of stopping it.

This presents a problem as the JLF specification section 12 under row sorting
states that users should be given the chance to sort by clicking the column
header. If the user is forced to stop the editing session by hitting return or
changing focus to another cell, the sort will require an extra click. Also,
since the column header is part of the table, the click on a header should
perform the same as clicking on an another cell of the JTable.
(Review ID: 108762) 
======================================================================