Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Duplicate items in JCombobox

 
Shiv Sidhaarth
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a jcombobox in GUI which contains some duplicate items also. Assume there are 3 items which is same as "Mutex". When i select second "Mutex" or third "Mutex", the selected item and selected index is always pointing to first occurance of "Mutex". How can i correct, so that the selected index/item is right one, instead of first occurance of item?
Thanks in advance,
Sankar S V
 
Rene Liebmann
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the reason for having two or more equal entries in a JComboBox? There is no sense in my opinion. Even if there is an different object behind, the user can't know that.
 
Shiv Sidhaarth
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Those three "Mutex" are like overloaded functions which have same names but different parameters. As and when the user select each one of them, their corresponding parameters are shown. This is how, it makes sense to user.
Sankar.S.V
 
Rene Liebmann
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, this makes sense.
Here is a little sample, which works in that way, which is needed by you:
 
Shiv Sidhaarth
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx a lot for your timely help, Rene.....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic