aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Duplicate items in JCombobox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Duplicate items in JCombobox" Watch "Duplicate items in JCombobox" New topic
Author

Duplicate items in JCombobox

Shiv Sidhaarth
Ranch Hand

Joined: Aug 06, 2001
Posts: 119
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

Joined: May 02, 2002
Posts: 196
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

Joined: Aug 06, 2001
Posts: 119
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

Joined: May 02, 2002
Posts: 196
OK, this makes sense.
Here is a little sample, which works in that way, which is needed by you:
Shiv Sidhaarth
Ranch Hand

Joined: Aug 06, 2001
Posts: 119
Thanx a lot for your timely help, Rene.....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Duplicate items in JCombobox