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

[2364 byte] By [max25a] at [2007-10-3 11:13:59]
# 1
You should have posted the link to the swing thread too :) http://forum.java.sun.com/thread.jspa?threadID=790823&messageID=4494159#4494159
PhHeina at 2007-7-15 13:37:53 > top of Java-index,Java Essentials,New To Java...
# 2
Any idea friends?
max25a at 2007-7-15 13:37:53 > top of Java-index,Java Essentials,New To Java...