Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Swing Combobox with Autocomplete and Context Menu

I have auto complete for a JCombobox working by following this article:

http://today.java.net/pub/a/today/2007/07/19/adding-auto-completion-to-swing-comboboxes.html

I am using the SwingX library.

Now I would like to add persistence support to the items in the combo box. Basically when you right click an item a context menu comes up and you can remove the item. The same thing with the delete key.

To add an item the user just types a new entry which in not in the list yet.

I haven’t found a way to hook up a context menu yet.


1 Answers

You can add key listener on combo box to look for delete key. As for the popup, you'll have to implement it by yourself.

like image 173
Marko Avatar answered Dec 08 '25 08:12

Marko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!