-
Bug
-
Resolution: Won't Fix
-
P3
-
None
-
1.4.0, 6
-
generic, x86
-
generic, linux
Name: jk109818 Date: 06/11/2002
FULL PRODUCT VERSION :
Linux:
java version "1.3.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)
Windows NT4.0 SP6:
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 :
glibc-2.2.4-22
Linux d241s086.osl.be 2.4.13 #9S SMP Thu Dec 13 12:46:27
CET 2001 i686 unknown
Caldera OpenLinux 3.1
ADDITIONAL OPERATING SYSTEMS :
Windows NT4 SP6a
A DESCRIPTION OF THE PROBLEM :
In a JTable, if the row at index 0 is selected and if a new
row is inserted at index 0, rows at index 0 and index 1
becomes selected (Only row at index 1 should be selected)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. selected row at index 0 in a JTable
2. insert a new row at index 0
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected: row at index 1 is selected
Actual: rows at index 0 and 1 are selected
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* JTableSelectionTest.java
*
* Created on June 11, 2002, 9:35 AM
*/
/**
*
* This code demonstrates the selection error when a row is inserted at
position 0
* when the row at index 0 is selected.
* Just launch this and click on the "Insert at 0" button to see the bug in
action.
*
* @author Frederic Rouyre
*/
import javax.swing.table.DefaultTableModel;
public class JTableSelectionTest extends javax.swing.JFrame {
/** Creates new form JTableSelectionTest */
public JTableSelectionTest() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {
jButton1 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});
jButton1.setText("Insert At 0");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1, java.awt.BorderLayout.WEST);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
}
));
jScrollPane1.setViewportView(jTable1);
getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
pack();
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Add your handling code here:
model.insertRow(0, insert);
}
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {
System.exit(0);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
JTableSelectionTest test = new JTableSelectionTest();
test.model = new DefaultTableModel(data, title);
test.jTable1.setModel(test.model);
test.jTable1.setRowSelectionInterval(0,0);
test.show();
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
// End of variables declaration
public static final String[][] data = {
{ "hello", "world" },
{ "we", "are" },
{ "showing", "the" },
{ "bug", "!!!!!!" }
};
public static final String[] insert = { "Insert", "This" };
public static final String[] title = { "Text1", "Text2" };
DefaultTableModel model;
}
---------- END SOURCE ----------
(Review ID: 153447)
======================================================================
FULL PRODUCT VERSION :
Linux:
java version "1.3.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)
Windows NT4.0 SP6:
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 :
glibc-2.2.4-22
Linux d241s086.osl.be 2.4.13 #9S SMP Thu Dec 13 12:46:27
CET 2001 i686 unknown
Caldera OpenLinux 3.1
ADDITIONAL OPERATING SYSTEMS :
Windows NT4 SP6a
A DESCRIPTION OF THE PROBLEM :
In a JTable, if the row at index 0 is selected and if a new
row is inserted at index 0, rows at index 0 and index 1
becomes selected (Only row at index 1 should be selected)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. selected row at index 0 in a JTable
2. insert a new row at index 0
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected: row at index 1 is selected
Actual: rows at index 0 and 1 are selected
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* JTableSelectionTest.java
*
* Created on June 11, 2002, 9:35 AM
*/
/**
*
* This code demonstrates the selection error when a row is inserted at
position 0
* when the row at index 0 is selected.
* Just launch this and click on the "Insert at 0" button to see the bug in
action.
*
* @author Frederic Rouyre
*/
import javax.swing.table.DefaultTableModel;
public class JTableSelectionTest extends javax.swing.JFrame {
/** Creates new form JTableSelectionTest */
public JTableSelectionTest() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {
jButton1 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});
jButton1.setText("Insert At 0");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1, java.awt.BorderLayout.WEST);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
}
));
jScrollPane1.setViewportView(jTable1);
getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
pack();
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Add your handling code here:
model.insertRow(0, insert);
}
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {
System.exit(0);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
JTableSelectionTest test = new JTableSelectionTest();
test.model = new DefaultTableModel(data, title);
test.jTable1.setModel(test.model);
test.jTable1.setRowSelectionInterval(0,0);
test.show();
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
// End of variables declaration
public static final String[][] data = {
{ "hello", "world" },
{ "we", "are" },
{ "showing", "the" },
{ "bug", "!!!!!!" }
};
public static final String[] insert = { "Insert", "This" };
public static final String[] title = { "Text1", "Text2" };
DefaultTableModel model;
}
---------- END SOURCE ----------
(Review ID: 153447)
======================================================================