Forum Stats

  • 3,855,210 Users
  • 2,264,475 Discussions
  • 7,905,930 Comments

Discussions

create JComboBox cell editor for JTable

User_6T1AO
User_6T1AO Member Posts: 247 Employee

Hi,

I am trying to create a JCombobox cell Editor for JTable by following the instructions given in the below url,


Getting the look & feel as expected. Able to change the menu selection. But the change in menu selection not persisting with different row selection. I mean, when I try to select the different row, unable to persist the menu selection change.

Ex: I've two rows, row1 & row2. Column 5 is named as 'Status' with different status values like 'Review', 'Complete', 'Progress', 'Inactive' ..etc. Initially row-1 is having status as 'Review' and row-2 is having status as 'Complete'. I tried to change the status of row-1 to 'Progress'. Till now, it's ok. Now I am selecting the row-2, the status of row-1 is changed to 'Review' which is it's initial value.

I tried to debug the code. Found that, setValueAT() method of AcmsFilesTableModel extends AbstractTableModel is not getting the changed selected value.

public void setValueAt(Object value, int row, int column) {}

Do we need to do any thing to persist the selected value in combobox? Pls correct me if Iam doing something wrong.


Please find the attached table model & cell editor implementation classes.


Thanks,

Samba.