Skip to main content

HOw to get value in Jcombobox?

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
gee16
Offline
Joined: 2011-06-16

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));

I ahve render also.But if the user not slected anything,in model.getDateCetor null value is coming.

Thanks

Gee