How to render a cell depending on another cell value!!?
Hi,
I was trying to render a cell depending on the value of another cell. I could able to render the whole column for the cell. But i am not able to render only a single row. I don't want to hard code the cell no. here how i am trying to call the renderer :
publicvoid tableChanged(TableModelEvent e){
//System.out.println("Entering the Table Model Event Block");
//System.out.println("Inside the Table Model Event UPDATE Block");
int row = e.getFirstRow();
int column = e.getColumn();
if(e.getType() == TableModelEvent.INSERT){
int iRows = table.getModel().getRowCount();
for(int i = 0; i < iRows; i++){
if(modelSupplierData.getValueAt(row, 7).toString().trim().equals("Multiple")){
System.out.println("YES");
//############################
//############################
// i am trying to set a button in the cell, is it correct way?
//############################
modelSupplierData.setValueAt(new ButtonEditor(new JCheckBox()), row, 9);
modelSupplierData.setValueAt(new ButtonRenderer(), row, 9);
}else{
//if not "Mulltiple"
System.out.println("NO");
}
}
But is not working its only showing up the properties of the button renderer. Am i doing something wrong here : modelSupplierData.setValueAt
** Posted in swing forum also.
Message was edited by:
max25

