• 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
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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
 
Evacuate the building! Here, take this tiny ad with you:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic