Win a copy of Microservices Testing (Live Project) this week in the Spring 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

searcheable jcombobox custom renderer

 
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have the following code:


Everything is fine but I want to gain possibility to search through the combo box. Now, the searching is possible but it uses toString() from Man class. I want to get the right object when I type "test". Overriding toString() in Man is impossible because in the real project it is complicated class. Moreover model should be independent from renderer.
To sum up:
I want to search through combo box with my custom renderer. Searching should match the labels which the user can see and then return the object which lies behind the label
Does anyone have any idea?


I really appreciate any help!
 
Marshal
Posts: 27286
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Lucas Smith wrote:Everything is fine but I want to gain possibility to search through the combo box. Now, the searching is possible but it uses toString() from Man class. I want to get the right object when I type "test". Overriding toString() in Man is impossible because in the real project it is complicated class.



I would write a wrapper class for the Man object which had a suitable toString() method. Example:
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic