I've a JComboBox in 3rd and 4th column of a JTable but I don't know how to get its items...the problem isn't the method to get items but the cast
JComboBox combo=(JComboBox) jTable1.getColumnModel().getColumn(3).getCellEditor();
Can you help me please?
The JComboBox
is wrapped in a CellEditor
. You must retrieve the wrapped component, for example when using DefaultCellEditor
:
DefaultCellEditor editor = (DefaultCellEditor)table.getColumnModel().getColumn(3).getCellEditor();
JComboBox combo = (JComboBox)editor.getComponent();