Skip to main content

How to get Combobox value in JTable

2 replies [Last post]
rajeshk_pondy
Offline
Joined: 2006-02-15

Hi All,

In my DefaultTableModel's Jtable one column has JCombobox. My problem is when i click the button it should display the selected value of perticular row's Combobox value. I am using getValueAt for getting Other columns values. But i don't know how to get values in Jcombobox in Jtable. Any one Can help me?

Sample Code:
public String[] values = {"A", "B", "C"};
JComboBox combo = new JComboBox(values);
TableColumn tbcol = table1.getColumnModel().getColumn(2);
tbcol.setCellEditor(new DefaultCellEditor(combo));

Thanks,
Rajesh.K

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gee16
Offline
Joined: 2011-06-16

HI ,

Have you found out the solution for the above one?please let me know the solution.

Thanks,

leo_test
Offline
Joined: 2004-04-27

You have to specify as well the Render, otherwise nothing is displayed after the Editor is finished.