• 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:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

A JTable question

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
I will suppress my every urge. But not this shameless plug:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic