File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes how to render a Combobox (or other things) in just one Cell Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to render a Combobox (or other things) in just one Cell" Watch "how to render a Combobox (or other things) in just one Cell" New topic
Author

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

Jason Richard
Ranch Hand

Joined: Oct 05, 2007
Posts: 69
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?
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2191
    
    7
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

Joined: Oct 05, 2007
Posts: 69
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!
 
GeeCON Prague 2014
 
subject: how to render a Combobox (or other things) in just one Cell