Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic