[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

JComboBox Key/Value pair

Asked by kwex in Parsers

Tags: JComboBox

Pls refer to this url on this site: http://www.experts-exchange.com/Programming/Languages/.NET/Q_22872468.html

I've created the key/value pair combo successfully. Hw do I select from it to use in my application.

I currently have two options:

 Integer id;
        id = cmb_student.getSelectedIndex();
       
        System.out.println("Clicked: " + id);

OR

   Integer id;
        id = Integer.parseInt(cmb_student.getSelectedItem().toString());
        System.out.println("Clicked: " + id);

None gives me the key which I received from d database.

Thanks.
[+][-]01/02/09 05:45 AM, ID: 23279223Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/02/09 06:00 AM, ID: 23279307Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/02/09 06:03 AM, ID: 23279320Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/02/09 06:12 AM, ID: 23279388Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93 - Hierarchy / EE_QW_3_20080625