Originally posted by ram_shyam:
Hi all,
Here is my requirement -
When the value of a particular cell in a JTable gets changed, another cell in the same selected row should display a JButton. I tried using a ListSelectionListener and with valueChanged() method, the JButton can be made to dispplay whenever a value of the selected row gets changed. But, since the renderer and the editor for this JButton is set for the entire column, JButton gets displayed for the entire column on clicking the cells and not only for the row in which the value is changed.
Here is the code for setting the renderer and editor for that column-
TableColumnModel colModel = aTable.getColumnModel();
TableColumn undoColumn = colModel.getColumn(6);
undoColumn.setCellRenderer(new ButtonRenderer());
undoColumn.setCellEditor(new ButtonCellEditor(undoButton));
Is there a way by which the button gets displayed only for the cell whose row has any value change and not for the entire column?
Please clarify
Thanks in advance!!!
Originally posted by ram_shyam:
Hi,
I actually searched to do the same as what you have suggested. But I couldnt find any such way to set the editor/renderer to a specific row/cell other than for the entire column.
Could you please send me some useful link on this or explain how this can be done?
Thanks in advance!!
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|