Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

A JTable question  RSS feed

 
igwe kalu kalu ogba
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I wanted a combo box in one of the cells of my JTable. I used this


String[] items = { "true", "false"};
JComboBox editor = new JComboBox( items );
DefaultCellEditor dce = new DefaultCellEditor( editor );
table4.getColumnModel().getColumn(1).setCellEditor(dce);

But the problem I have is that it sets the comboBox for all of my JTable cells. I only want it for one cell. Please how do I do this. Thank you .
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no abstraction of a single table cell; I don't think what you want to do is possible. Even if it were, surely it would make the GUI a bit inconsistent and hard to use; tables are supposed to represent data where each row contains the same type of data. Perhaps if you explained the problem somebody could suggest an alternative approach?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!