wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes On button click populate combobox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "On button click populate combobox" Watch "On button click populate combobox" New topic
Author

On button click populate combobox

veda Cherak
Greenhorn

Joined: Aug 16, 2011
Posts: 13
Hi All,
My scenario is when I click a button I connect to DB fetch the records and populate the combo box.

I am able to retrieve the data from db but not able to populate the combo box.

Please suggest.

Veda
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

Create a new DefaultComboBoxModel with the elements, then set that model for the combo box (setModel).


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
veda Cherak
Greenhorn

Joined: Aug 16, 2011
Posts: 13
Thank you so much Rob. It worked
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

You're welcome.
 
jQuery in Action, 2nd edition
 
subject: On button click populate combobox
 
Similar Threads
Populating Combo Box using one of the fields in oracle
Search fields
populate the select when page is displayed first time
Swings
combobox is not updating in Swing GUI