How to get CheckBox in JTable to set correct underlying data
I have a problem that is being caused by the fact that in a JTable only one JComboBox is created for a columm.
I have a JTable that represents values for underlying data that is kept in an xml structure. One of the elements of the underlying data is shown in a column that is best represented as a JComboBox (with dropdown values for type of communication protocol). I was expecting that I could create a subclass of JComboBox that would store the path to the XML value and use the actionPerformed method to ge thet new value and update it in the XML structure. However, the way JTable works is that when a JComboBox is used in a column, only one instance of the JCOmboBox is created and it is used as a "rubber stamp" to create all the cells in the column Because of this I am loosing the XML information associated with individual ComboBoxes.
I can work around this by writing a table model and using the setValueAt method to get the value, get the row, lookup the XML path in another table and then set the underlying value. However, I have a requirement to set the color of the cell to green if the value is changed from its default and at that point I don't know how to get the ComboBox cell to render(setVAlueAt jsue has value, row and column.
Does anyone know a way to actually have separate JCheckBoxes for each cell in a column? (I know this is not the best for performance) Or how to get at a particular cell to have it repaint?