I have a JTable with a few rows in it. Once it being showed on the screen a top-left cell is being hightlighted as it has a focus or something like that. After you press mouse or TAB the that selection eliminates. This reproducible always in my environment.
This is a regression introduced between JDK6.0b54 and b56. (but can't track exact CR number)
May be there is already a dup for this report but I don't remember it. Anyway, I verified it with my recent workspace which is approximately the same as JDK6.0b69 so looks the bug is still there.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
public class MinTableTest extends JFrame {
Object[][] data = new Object[][]{ {"A1","B1","C1",}, {"A2","B2","C2",}, } ;
Object[] column = new Object[]{"a","b","c",};
JPanel jPanel1 = new JPanel(new FlowLayout());
JScrollPane jScrollPane1 = new JScrollPane();
JTable jTable1 = new JTable();
JCheckBox jCheckBox1 = new JCheckBox();
JComboBox jComboBox = new JComboBox(column);
public MinTableTest() {
DefaultTableModel tableModel = new DefaultTableModel(data,column);
jTable1.setModel(tableModel);
jScrollPane1.getViewport().add(jTable1);
jCheckBox1.setText("JPanel.setEnabled");
jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jPanel1.setEnabled(jCheckBox1.isSelected());
}
});
jPanel1.add(jScrollPane1);
jPanel1.add(jComboBox);
jPanel1.setEnabled(false);
getContentPane().setLayout(new FlowLayout());
getContentPane().add(jPanel1);
getContentPane().add(jCheckBox1);
addWindowListener( new WindowAdapter() {
public void windowClosing( WindowEvent e ) {
System.exit(0);
}
});
pack();
setVisible(true);
}
public static void main(String[] args) {
new MinTableTest();
}
}