0
我想單擊JTable
行。點擊任何行的第一列(column.index=0
),將突出顯示該行。單擊行中的任何其他列不應突出顯示該行。我該如何認識到這一點?通過點擊確定列來避免行選擇JTable
我想單擊JTable
行。點擊任何行的第一列(column.index=0
),將突出顯示該行。單擊行中的任何其他列不應突出顯示該行。我該如何認識到這一點?通過點擊確定列來避免行選擇JTable
// Sry基因 - 與編輯工具problemes
公共類JTableTest擴展javax.swing.JFrame中{
public JTableTest() {
initComponents();
}
private void initComponents() {
jButton1 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
setDefaultCloseOperation(EXIT_ON_CLOSE);
jButton1.setText("jButton1");
getContentPane().add(jButton1, java.awt.BorderLayout.SOUTH);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{"click will select", null},
{"click will select", null},
{"click will select", null},
{"click will select", null}
},
new String [] {
"String", "Boolean"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.Boolean.class
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
});
jScrollPane1.setViewportView(jTable1);
getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
pack();
}
public static void main(String args[]) {
new JTableTest().setVisible(true);
}
private javax.swing.JButton jButton1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
}
你能證明你的代碼? – Sionnach733