Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Keeping id's of list for JCombobox

807603Dec 2 2007 — edited Dec 3 2007
Hi,

i'm filling a JCombobox with database values (Strings) of a table. Every string has an internal ID, which i use to store in other tables.. My problem is the following: i know i can detect what the user selected (getSelectedIndex() and getSelectedValue()), but what does that mean to me. GetSelectedIndex is only a number and GetSelectedValue is the text in de combobox, which i only a text i don't want to store. What i do want to know, is the internal ID behind that value. I don't want to retrieve my database again because i know the String of the table to get the internal ID.

I solved my problem by extending a JCombobox and keeping track of my internal ID's in a int[], but i don't know if this is the best solution.

Am I missing something? Is there a very simple solution for my problem?

Greetz
Peesjee
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 31 2007
Added on Dec 2 2007
3 comments
1,289 views