• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Regarding JComboBox in a JTable

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
I have the JTable with my last column that has to be rendered as a JComboBox. But, I'm not able to expand it and select a different value. I'm not able to find out what am I doing wrong. Please can anyone help.
My code is as follows:

 
seema prakash
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did get help and the mistake was in my
class JTableButtonModel extends AbstractTableModel {
.....
public boolean isCellEditable(int row, int column) {
return false;
}
....
}


I had to change it to this

class JTableButtonModel extends AbstractTableModel {
.....
public boolean isCellEditable(int row, int column) {
// 1st solution
return true;

// or 2nd solution, make it such that only column 2 it editable
if(column == 2) {
return true;
}

return false;
}
....
}

I hope it will be helpful for someone with the similar problem.
 
reply
    Bookmark Topic Watch Topic
  • New Topic