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 On button click populate combobox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
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: 19543
    
  16

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: 19543
    
  16

You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: On button click populate combobox
 
Similar Threads
Search fields
populate the select when page is displayed first time
Swings
combobox is not updating in Swing GUI
Populating Combo Box using one of the fields in oracle