• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic