aspose 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: 19762
    
  20

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: 19762
    
  20

You're welcome.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: On button click populate combobox