J
JavaEnquirer
Hi,
I have a JTable in which the first column is a checkbox ( The table
model getColumnClass method returns Boolean for this column )
Now, when a row gets selected, I also want the checkbox to become
selected. To acieve this, I implemented the
public void valueChanged(ListSelectionEvent e) method as follows:
super.valueChanged(e);
if (e.getValueIsAdjusting() )
{
TableModel model .......
int index = e.getFirstIndex();
// the setValueAt method ensures that only one
// box may be checked at a time
model.setValueAt(new Boolean(true),index,0);
}
Although the code above exhibits the desired checkbox behaviour i.e.
when I select a row ( at any column ), the checkbox updates
appropriately, I HAVE NOW LOST THE DEFAULT ROW SELECTION BEHAVIOUR -
even though, I call super.valueCahnged(e)
It doesn't matter where I call super.valueChanged, I can't get the
default selection behavior WITH my checkbox style group behaviour.
Many thanks in advance.
I have a JTable in which the first column is a checkbox ( The table
model getColumnClass method returns Boolean for this column )
Now, when a row gets selected, I also want the checkbox to become
selected. To acieve this, I implemented the
public void valueChanged(ListSelectionEvent e) method as follows:
super.valueChanged(e);
if (e.getValueIsAdjusting() )
{
TableModel model .......
int index = e.getFirstIndex();
// the setValueAt method ensures that only one
// box may be checked at a time
model.setValueAt(new Boolean(true),index,0);
}
Although the code above exhibits the desired checkbox behaviour i.e.
when I select a row ( at any column ), the checkbox updates
appropriately, I HAVE NOW LOST THE DEFAULT ROW SELECTION BEHAVIOUR -
even though, I call super.valueCahnged(e)
It doesn't matter where I call super.valueChanged, I can't get the
default selection behavior WITH my checkbox style group behaviour.
Many thanks in advance.