This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line!
See this thread for details.
  • 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Autocomplete JComboBox with image

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

i am using JComboBox which have product name product image, to make it autocomplete i used below listener but name and image in drop down is not getting highlight :-


Please let me know if code is not complete to understand.

looks CaretPosition is not getting set properly due to image in JCombobox. Any idea how can i set Caret Position to correct index?

Thanks
Anchit
 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
- no idea how Icon/ImageIcon(s) is/are ... , because there are three-four (correct) ways, leaving any guessing, comments

- I would not recommend to use KeyListener, KeyEvent for this job, nor for JTextComponents (derived Editor from JComboBox) every those event are manageable in DocumentListener, DocumentFilter

- start with AutoComplete JComboBox/JTextField or decorator/highlighter by SwingX

- with standard rendering as is described in Oracle tutorial aboout How to use ComboBoxes
 
Please enjoy this holographic presentation of our apocalyptic dilemma right after this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic