JComboBox dilemma in JTable
Posted on 2003-02-26
I have multiple TableCellEditor for the columns in my JTable. Here is the structure of my JTable:
Initially, the JTable only contains headers and empty cells. The user clicks cell(0, 0) to select from JComboBox's popup menu.
Column1 has 5 lists of choices for the JComboBox. Depending on what the user has selected in Column0's JComboBox, Column1 displays a JComboBox popup menu accordingly. Once the users clicks an item in Column1's JComboBox popup menu, Column2's value in the same row is set accordingly.
I create a TableCellEditor for row and it seems to work. However, when the user changes the selection in Column0 that contains a value, it doesn't affect Column1 until the user clicks the cell in Column1.
The problem is that the user has to click the cell to make the JComboBox visible. I don't want to set default selectedIndex for the JComboBox, so I paint the cell in Column1 to flag the user the change in Column0. Is there any better solution?
Thanks in advance.