0

Hey Everyone! I need some help with a JTable I'm working on.

TableColumn column = table.getColumnModel().getColumn(2);
...
JComboBox comboBox = new JComboBox();
comboBox.addItem("A");
comboBox.addItem("B");
comboBox.addItem("C");
comboBox.addItem("D");
comboBox.addItem("E");
comboBox.addItem("F");
column.setCellEditor(new DefaultCellEditor(comboBox));

I know that the code above will take the column of the table at index 2 and give each cell in that column a combo-box where they can choose options A through F. My question is, what if I want a different combo box for different cells in the column? Like I want certain cells in the column to have options A, B, and C in the drop down, and others to have options D, E, and F. How do I do this?

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by kvass
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.