• 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

how to render a Combobox (or other things) in just one Cell

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I'm sure that there is an answer somewhere for this, but everything i look for seems to be specific for an entire column.

what i have is a JTable. This JTable is used for user preferences. I want to have certain CELLS to have a JComboBox.

So in Column 1, row 1,row2,row3, and row 4 would all be just normal Text, but Column 1 Row 5 is a JComboBox with particular values. Thus far it's been all or nothing.

Any thoughts?
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Override the getCellEditor() method of JTable. In the example below a comboBox editor is displayed in rows 0, 1, 2. All other rows use the default editor:


 
Jason Richard
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Rob,

You sir are a fine Gentleman, and I wish you many happy days doing whatever it is you love to do. If there is a way to make sure this post comes up when somebody googles "how do i render a JComboBox in just one particular cell of a JTable, and not in every row of that column", then you will make somebody else as happy as I am now.

I didn't implement it exactly, but



hot darn that was what i needed


Thanks again!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic