aur0n
aur0n

Reputation: 473

JComboBox in specific JTable cell

I've a problem that is driving me crazy.

I have a classic JTable, with several columns. I need that a particular column, instead of simple texts values in its cell, it must contain a ComboBox. I searched A LOT, all I found was examples that would implement the same JComboBox in each cell of the column, that it's not what I need: I need that each cell of the column has a combo box with different values.

Can anyone give me some practical example of how to do it, please?

Thanks.

PS: I'm using NetBeans.

Upvotes: 0

Views: 954

Answers (1)

JB Nizet
JB Nizet

Reputation: 691685

The TableCellEditor.getTableCellEditorComponent() method takes a row as argument. Use the existing example as a guide, and use the row argument of this method to decide which values must be proposed by the combo box.

Upvotes: 2

Related Questions