• 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

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
 
reply
    Bookmark Topic Watch Topic
  • New Topic