Name: jk109818 Date: 08/06/2002
FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
When JTable.setSelectionMode
(ListSelectionModel.MULTIPLE_SELECTION_INTERVAL) is used
with JTable.setCellSelectionEnabled(true), CTRL+Click
selects/deselects whole rows and columns, not just cells.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.Run the below program
2.Click on the top-left cell and then SHIFT+click on a cell
a few rows down and a few columns over.
3.Now CTRL+click somewhere in the middle of the selection
block.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Since I am in cell selection enabled mode I would expect
just the cell I clicked on in step 3 above to be
deselected. Instead, the whole row and column of the cell I
clicked on was deselected.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.io.*;
import java.awt.*;
import javax.swing.table.*;
import java.awt.event.*;
public class GridTest extends JFrame
{
TestTableModel m_model;
public GridTest()
{
try
{
setSize(200,300);
setLocation(100,100);
JTable table = new JTable(5,5);
table.setCellSelectionEnabled(true);
table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
this.getContentPane().add(table,BorderLayout.CENTER);
}catch(Exception e){}
setVisible(true);
}
public static void main(String[] args)
{
GridTest gridTest1 = new GridTest();
}
}
---------- END SOURCE ----------
(Review ID: 160426)
======================================================================