troubleshooting Question

Combo Boxes adding index Search this forum

Avatar of darren-w-
darren-w-Flag for United Kingdom of Great Britain and Northern Ireland asked on
Java
5 Comments1 Solution323 ViewsLast Modified:
Hi,

I have a JComboBox drop down and I would like to add an index next to it that is a specific code, how is this done?

ie : index   Text on pulldown

546fff  test1

546eee test2

56656  test3

fff6656  test4

at the monent  I'm creating a DefaultComboBoxModel and adding a result set item to it like this:

model = new DefaultComboBoxModel();
model.addElement("Please Select");
while (rs.next()) {
model.addElement(rs.getString(0));
}

So I would like to add the index to it, I assume I need to create an object, similar to a list on a webpage?

Darren
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros