Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,379 members, 7,808,347 topics. Date: Thursday, 25 April 2024 at 10:41 AM

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

Nairaland Forum / Science/Technology / Programming / Java : How Can I Add Combo Box To A Table (1400 Views)

Assist Me Wit Php Code To Insert Multiple Records In A Table / How Can I Add An Editor In The Textarea In An ASP.NET MVC Application / Have Problem Embeding Radio Buttons In A Table Cell (2) (3) (4)

(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)

No Need To Buy SMS Credit/unit To Send Bulksms To 10m With This Bulksms Software / Please I Need Sdk/api For Secugen Hamster Model: HSDUO3P / Programming

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 20
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.