₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,330,807 members, 8,447,177 topics. Date: Friday, 17 July 2026 at 07:56 PM

Toggle theme

Java : How Can I Add Combo Box To A Table - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingJava : How Can I Add Combo Box To A Table (1524 Views)

1 Reply (Go Down)

Java : How Can I Add Combo Box To A Table by Nobody: 9:47am On Aug 10, 2014
I'm using netbeans ide, how can I add a combo box in a table? I tried using drag and drop but didn't work

Re: Java : How Can I Add Combo Box To A Table by tjones007: 11:22am On Aug 10, 2014
Create a custom table model and cell renderer
Re: Java : How Can I Add Combo Box To A Table by Nobody: 11:40am On Aug 10, 2014
How pls? I already dragged and dropped the table,
How do I create custom table model and call renderer

tjones007: Create a custom table model and cell renderer
Re: Java : How Can I Add Combo Box To A Table by tjones007: 6:16pm On Aug 10, 2014
Thought you were designing the gui hand codedly.

Well, you can create class that extends DefaultTableCellRenderer

Then override the method public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean isFocused, int row, int column)

These method returns the desire component you want to use for a particular column. It could return a panel, combo box depending on what the programmer want the cell to hold.

The value in the method signature is the data the particular column contains. For example a table column may contain a image so the value is image.
So to use the image you cast the value to image.
(Image)value

You set the table cell renderer to the custom class you created.

You can use google to see examples of how it is created.
Re: Java : How Can I Add Combo Box To A Table by Nobody: 7:02pm On Aug 10, 2014
Thank you very much
tjones007: Thought you were designing the gui hand codedly.

Well, you can create class that extends DefaultTableCellRenderer

Then override the method public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean isFocused, int row, int column)

These method returns the desire component you want to use for a particular column. It could return a panel, combo box depending on what the programmer want the cell to hold.

The value in the method signature is the data the particular column contains. For example a table column may contain a image so the value is image.
So to use the image you cast the value to image.
(Image)value

You set the table cell renderer to the custom class you created.

You can use google to see examples of how it is created.
Re: Java : How Can I Add Combo Box To A Table by Nobody: 5:42pm On Aug 11, 2014
tjones007: Create a custom table model and cell renderer
tj, hw far, I know its been long and all, my phone got stolen plus the nairaland tsunami, that's why I haven't been I'm contact with you guys all this while.
is the group still alive? if it is, could you please drop the contact number, so miss you guys.
Re: Java : How Can I Add Combo Box To A Table by tjones007: 6:58pm On Aug 11, 2014
Preboy: tj, hw far, I know its been long and all, my phone got stolen plus the nairaland tsunami, that's why I haven't been I'm contact with you guys all this while.
is the group still alive? if it is, could you please drop the contact number, so miss you guys.
The group still alive. But dry. Miss you too. I was like maybe u took a break.
Are u still using d same contact number?
Re: Java : How Can I Add Combo Box To A Table by Nobody: 1:59am On Aug 12, 2014
tjones007: The group still alive. But dry. Miss you too. I was like maybe u took a break.
Are u still using d same contact number?
been unsuccessful retrieving it, just pm the group phone number @ preboyunique@gmail.com
Re: Java : How Can I Add Combo Box To A Table by sealteam66(m): 10:48pm On Aug 16, 2014
i dont understand your question, can you sketch what the final outcome will be like?
1 Reply

Assist Me Wit Php Code To Insert Multiple Records In A TableHow Can I Add An Editor In The Textarea In An ASP.NET MVC ApplicationHave Problem Embeding Radio Buttons In A Table Cell234

Building A PHP Framework For RADNeco, Waec And Nabteb ApiSoftware Programming Write