Dynamic JTable

Hello

I made a JTable with various columns, each column have a different Renderer and Editor. One of the columns is render with a JTextField. Now I must make a different thing: when I Select the option 'Date' in one of the JComboBoxes that is part of Table, the JTextField is substitued by an component of my own named DateInputField, that serves to input and output of Dates.

The problem is: when I select the option Date in combobox, the renderer doesn't change the JTextField for the DateInputField. I have tried to add an ActionListener to combobox, to call fireTableDataChanged(), but the listener only work when I exit the combo...

I was debugging and realized that in the editor of the column with the combo, the method getCellEditorValue() (from interface CellEditor) is called only when leave the cell / click on another component.

Someone have a light?

[896 byte] By [Janioa] at [2007-11-27 11:28:16]
# 1

Override the getCellEditor(...) method of JTable to return the appropriate editor based on your specific criteria.

camickra at 2007-7-29 16:21:06 > top of Java-index,Desktop,Core GUI APIs...
# 2

I tried that now, but the result is the same.

I have modified the action listener of JComboBox to change the mode atribute of the item in the row. Now is working!

Before I have tried to change this state in the CellEditor, but this wasn't right.

Thanks for the tip

Message was edited by:

Janio

Janioa at 2007-7-29 16:21:06 > top of Java-index,Desktop,Core GUI APIs...