mfAudi
asked on
Adding ID to JComboBox
Hello there,
I´ve got a problem with the JComboBox! I get a List of items, which I add to a JComboBox but I´m only able to add the "TEXT" to it. But I also have to add a ID, which identifies the Text, to the ComboBox. Do you have any Solution for my problem??
Thanks a lot for your help!
Greetings
Markus
I´ve got a problem with the JComboBox! I get a List of items, which I add to a JComboBox but I´m only able to add the "TEXT" to it. But I also have to add a ID, which identifies the Text, to the ComboBox. Do you have any Solution for my problem??
Thanks a lot for your help!
Greetings
Markus
The ComboBoxModel holds Object. You can make an object with those fields. Make its toString retrun what you want and it#'ll be displayed
ASKER
Can you show me a little Example??
THX
THX
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
mfAudi can you tell me why my answers were ignored?
This should have been a split.
ASKER
I don´t know! I accepted your last answer! And I also rated it as "GOOD"!
Why are you asking??
Why are you asking??
You accepted my answer, not CEHJ's.
>>I accepted your last answer!
No you didn't - you accepted *someone else's* answer ;-)
No you didn't - you accepted *someone else's* answer ;-)
ASKER
I´m sorry, so did I! But both answers were similar in quality!
Sorry CEHJ! Next time. I was to much in a hurry cause I have to solve a problem at my workingplace!
Have a nice WE!
CU
Sorry CEHJ! Next time. I was to much in a hurry cause I have to solve a problem at my workingplace!
Have a nice WE!
CU
>>But both answers were similar in quality!
I have to beg to differ and that's no disrespect to mayank. His link, while useful, does not deal directly with your specific problem
I have to beg to differ and that's no disrespect to mayank. His link, while useful, does not deal directly with your specific problem
Ah, so CEHJ takes the name finally in his 9 years at EE ;-)
mfAudi, if the sample code on the link which I posted helped you and if that was the one you used, then you should split the points between CEHJ and me because he had also posted a similar code earlier.
I'll ask Venabili to re-open.
mfAudi, if the sample code on the link which I posted helped you and if that was the one you used, then you should split the points between CEHJ and me because he had also posted a similar code earlier.
I'll ask Venabili to re-open.
:-)
ASKER
OK, no Problem! Both of you helped me very much!
But no I finisch working and I will do it on monday!
Hasta la vista!
Greetings from good old Germany! (SOCCER-World-Championship -2006) ;-)
But no I finisch working and I will do it on monday!
Hasta la vista!
Greetings from good old Germany! (SOCCER-World-Championship
:-)
>> Both of you helped me very much!
mfAudi, you can now follow the Split Points link which you see below (and above the comment box) to split points between CEHJ and me.
mfAudi, you can now follow the Split Points link which you see below (and above the comment box) to split points between CEHJ and me.
> Greetings from good old Germany! (SOCCER-World-Championship -2006) ;-)
Go the socceroos :)
Go the socceroos :)
:-)