Edit a Boolean in JTable
From: Bart_D (bart_at_cleaned.be)
Date: 03/31/04
- Next message: Sudsy: "Re: Struts and application properties"
- Previous message: Artur Wronski: "struts / DynaValidatorForm"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Mar 2004 08:30:43 -0800
Hello,
hope somebody can help me.
I have a JTable with Boolean values in a column. The JTable gets it's
values from a Vector (for which I have extended the
AbstractTableModel)
I am able to "edit" this column (set Boolean cell to true or false).
But the problem is : when I put one row to "true" all the other must
be set to false (this value also must be saved in a Vector).
Does anyone know how I can do this ? I need some kind of
"valuechanged" for the column with the Booleans.
I can check if the value is a Boolean with : (the table is called
setTable and the Boolean is in the third column)
int i;
for (i = 0;i<setTable.getRowCount();i++) {
if (((Boolean)setTable.getValueAt(i, 2)).equals(Boolean.TRUE))
{
System.out.println("true");
}
If i can check when a value in the third column (the Boolean column)
is changed, I can set all the values to false, except the one just
clicked.
Hope somebody can help me.
Bart
- Next message: Sudsy: "Re: Struts and application properties"
- Previous message: Artur Wronski: "struts / DynaValidatorForm"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|