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?

Solved it :P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.