Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Duplicate items in JCombobox  RSS feed

 
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
 
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.....
 
Can you really tell me that we aren't dealing with suspicious baked goods? And then there is this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!