H
Hole
Hi all,
I would like to get the reference of a component (in my case is a
JCheckbox) and call the setVisible method on it.
I tried to do it with getTableCellEditorComponent/
getTableCellRendererComponent but it doesn't work properly: it seems
that the property is being set on every component of the column.
Thanks in advance.
Below, the code I used:
for (int i=1; i<model.getRowCount();i++) {
Component check = siteResultsTbl.getCellEditor(i,
0).getTableCellEditorComponent(siteResultsTbl, null, false, i, 0);
Long vid1=(Long)model.getValueAt(i-1, 2);
Long vid2=(Long)model.getValueAt(i, 2);
System.out.println(vid1+" "+vid2);
if (vid1.equals(vid2)) {
check.setVisible(false);
System.out.println("check at "+i+" should be not
visible");
}
}
I would like to get the reference of a component (in my case is a
JCheckbox) and call the setVisible method on it.
I tried to do it with getTableCellEditorComponent/
getTableCellRendererComponent but it doesn't work properly: it seems
that the property is being set on every component of the column.
Thanks in advance.
Below, the code I used:
for (int i=1; i<model.getRowCount();i++) {
Component check = siteResultsTbl.getCellEditor(i,
0).getTableCellEditorComponent(siteResultsTbl, null, false, i, 0);
Long vid1=(Long)model.getValueAt(i-1, 2);
Long vid2=(Long)model.getValueAt(i, 2);
System.out.println(vid1+" "+vid2);
if (vid1.equals(vid2)) {
check.setVisible(false);
System.out.println("check at "+i+" should be not
visible");
}
}