JDK-6314530 : JTable row selection using 'Ctrl' + mouse may clear any currently selected rows
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2005-08-23
  • Updated: 2010-04-02
  • Resolved: 2005-08-23
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Linux Fedora Core 3

A DESCRIPTION OF THE PROBLEM :
When holding down the 'Ctrl' key to add to the selected rows in a JTable, sometimes the existing selected rows become unselected.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test application and select rows using the 'Ctrl' + mouse. At some point ALL the currently selected rows will become unselected.


REPRODUCIBILITY :
This bug can be reproduced often.

---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
 
public class JTableSelectionProblemDemo extends JFrame
{
    public JTableSelectionProblemDemo()
    {
        super("JTable Selection Problem Demo");
        
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
        final JTable table = new JTable(new TestTableModel());
        table.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        
        getContentPane().setPreferredSize(new Dimension(1024, 480));
        JScrollPane scrollPane = new JScrollPane(table);
        getContentPane().add(scrollPane);
        
        pack();
    }
    
    private static class TestTableModel extends AbstractTableModel
    {
        public String getColumnName(int column)
        {
            return "Hi " + column;
        }
        
        public int getColumnCount()
        {
            return 10;
        }
        
        public int getRowCount()
        {
            return 100;
        }
        
        public Object getValueAt(int rowIndex, int columnIndex)
        {
            return "[" + rowIndex + "," + columnIndex + "]";
        }
    }
    
    public static void main(String[] args)
    {
        new JTableSelectionProblemDemo().setVisible(true);
    }
}

---------- END SOURCE ----------

Comments
EVALUATION Duplicate of 6195469 which will be fixed in Mustang and 5.0 update 6.
23-08-2005