Originally posted by ram shyam:
I have a customised tableCellRenderer to display a button in one of the columns in the table. I find that this renderer class is being called continously when the corresponding screen/table is invoked. Using the debug mode in Eclipse IDE and setting a breakpoint in the renderer class, I find that the debugger hits the breakpoint continously. And I find CPU usage to the maximum whenever this table is invoked.
Is this the right behavior of the table cell renderer as I have not seen such performance issues in other cases.
Please clarify.
Originally posted by ram shyam:
Here is the code for the renderer-
Originally posted by ram shyam:
I am doing some condition checking based on which I am rendering the JButton UndoButton. But after removing the model.setValueAt() now, and doing some changes on the table, I couldnt get the undoButton displayed unless I click some other row. The button is not getting reflected immediately after making any changes although I have the following code in my tableModel and gets displayed only after clicking some other row-
=================================================================
Vector rowSet = (Vector) dedicatedAccountsData.elementAt(row);
rowSet.setElementAt(aValue,col);
fireTableCellUpdated(row, col)
Originally posted by ram shyam:
I used the logic in the TableCellRenderer itself which you suggested that this has to be done in TableModel. Inside getValueAt(int row, int col), the value has to be returned for all the rows and columns. But in my case, the value of "Jbutton" has to be returned only in specific cases and at the sametime, return the other values in other columns. How can this be achieved in getValueAt()?
Also, I have one more problem in the existing code itself. I am using a TableSorter to the sort each column on clicking the corresponding column header. In my case, sorting happens correctly, but after sorting, the renderer is called in which, my logic of comparing the changed values is executed which causes an issue.
Originally posted by ram shyam:
And as you suggested, in the renderer, I could check for the value and return undoButton. But, when I try to sort the columns, getValueAt() will again be called everytime (Same as the renderer),
and again the same issue still exists as I had already mentioned in my previous post, ie, the new values returned from the rowSet will be in sorter order, whereas the values with which these will be compared will not be and hence, the spcl_value will be returned in incorrect places.
Originally posted by ram shyam:
Is it advisable to use model.setValueAt() inside getCellEditorValue() method?
The problem is that I have an editor which is used to open a dialog-pop up window on clicking any of the rows in the table. On entering data in the pop-up and pressing OK, the entered data should be set in the corresponding row from which the pop-up is opened.
There are two values that could be changed but in getCellEditorValue() method, both the values cannot be returned at a time.
luck, db
There are no new questions, but there may be new answers.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions