• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

fill jcombobox from DB ?

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone help me to figure out how to fill a JComboBox from a database? Should I fill it automatically when the application opens so the values are always there or do I load them on some event?
I searched the Forums and could not find anything. Any code would be great!
Thanks,
Steve
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is tough to give design answers when you haven't given any information. How often the underlying data changes is a factor in the when to load. You should also insure that your database calls are not directly in your user interface.
 
steve dowdall
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Paul. Sorry it was a little lite on the details.
This is what I want to do. I have a SQL DB (DevDb) and the data will not be changing much. I want to read the values from a column(cust_id) in a table (customers) and fill the jComboBox with the values.
As far as the user interface goes, I am planning on loading the jComboBox by making a call to another class and executing a method in there. Is that an ok way to do it?
Steve
 
Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic