• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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: 3244
30
  • 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!
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic