This is not entirely impossible, but there is a lot of work to do the work. You will need to create your own classes to extend / implement all these functions:
- ListCellRenderer (so that you can mark the selected items when the popup shows and indicates (at least) that there are several options when it is not).
- JComboBox (obviously)
- BasicComboBoxUI (actually this is most of the work)
- BasicListUI (at least I had to)
- ComboBoxModel
And you will need to develop your own class that implements ItemListener, MouseListener, PopupMenuListener, MouseMotionListener, PropertyChangeListener, KeyListener, ListSelectionListener.
Hint: you need to override the many createXXXListener () methods in the user interface classes to get around many places where multiple selections are selected.
[And he still doesn't allow
editable multi-screen combos.]
Rob blaskett
source share