Sandhya ChowhanPawar

Greenhorn
+ Follow
since Nov 21, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sandhya ChowhanPawar

thanks nikhil and paul!
i've tried using a similar example and it works, its just that when i assign " final Object[][] data = ... " differently it is not working, maybe because I want that boolean col to be editable. so basically i'm in using a 2d vector inseading of decl like u had it ... checkit out:
Vector dataModelVector = new Vector();
String userName = "Sam";
String userLastname = "Smith";
Boolean local = Boolean.TRUE;
dataModelVector.addElement(userName );
dataModelVector.addElement(userLastname);
dataModelVector.addElement(local);
tableModelVector.addElement(dataModelVector);
col.add("First Name");
col.add("Last Name");
col.add("Local");

.
.
.
model = new DefaultTableModel(tableModelVector, col){
public boolean isCellEditable(int r, int c){ return (c ==2)
}
public String getColumnName(int column) { return col.elementAt(column).toString(); }
public Object getValueAt(int row, int column) { return (Vector)tableModelVector.elementAt(row)).elementAt(column);
}
public void setValueAt(Object value, int row, int column){
if (value instanceOf Boolean && c==2)
((Vector)tableModelVector.elementAt(row)).setElementAt(value, Boolean.TRUE);
else
((Vector)tableModelVector.elementAt(row)).setElementAt(value, column);
fireTableCellUpdated(row, column);
}
};
thanks guys!
sandhya
22 years ago
I am having trouble displaying a JCheckBox in a JTable. I am using table model to populate the table, however for the checkbox in a column is not displayed so I have to use text instead? I've tried using the render but it doesn't display the checkbox either.
Thanks!
Sandhya
22 years ago