• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Finding an objects index in a list?

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a Jlist whose list model is built with an array of objects. I have another aray of objects that is a subset of the first array (in other words the list might have objects 1-7 and the subset array has objects 2, 4, and 6).
I would like to select all of the indexes of the objects in the second array. JList has a method to select an index by supplying an object:

However if called several times it sets the selected only to the last object it was sent. There is not equivelant method that takes an object array. I didn't seem to find a method that gets the index of a particular Object.
Is there something I'm missing? Could somebody help me out?
Please? Nobody has responded to the three other questions I've asked.
Thanks,
Michael Crutcher
 
Michael Crutcher
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got around it by doing this: (duh)

Still, is there no direct way to know what index position an object is at without overiding the list model?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic