You have to implement your own TableCellRenderer. in the method getTableCellRendererComponent you can return your Timer. But please have in mind, that you have to handle the selection stuff (background and foreground color). If you don't handle this, it might look a bit strange.
if the panel that is the renderer for one of the columns (your timer class) is bigger than the other cells, the row height and the row width won't be adopted to it. instead, the panel will be shrunken to fit into the cell. you have to set the row height and width accordingly. take a look at the DefaultTableCellRenderer in 1.4: it overwrites the paint() and update(), invalidate() etc. method to improve performance - you might do that in your renderer as well. no (mouse)events will be propagated to the components on the panel used as renderer unless you use the right TableCellEditor. I found the source of a class with these functionalities on the net, but I have no bookmark and I can't find it right now. sorry. I can paste you some code, if you need it, but I have adopted it to my needs. Chantal
I am facing some problem while executing the code. The class which is a timer class executes fine when I run it as a standalone application. But when I run it using the JTable and implementing TableCellRenderer, the values don't change. It changes only when I click on the cell. What is problem?
that means, the table gets no notification to update itself unless you click into the cell. check that your table model does fire the appropriate event whenever the values in the panel change. (there are events that don't trigger a table update! can't remember which ones, try it out.) tableModel.getValueAt() has to be called by the table whenever it updates cells. chantal