To do this, you need to create a new combobox user interface:
combo.setUI(new BasicComboBoxUI() { protected JButton createArrowButton() { return new JButton() { public int getWidth() { return 0; } }; } });
But be careful to inherit from a basic UI that matches your current look and feel.
For example, if you use a substance, you should get a new user interface from SubstanceComboBoxUI
instead of BasicComboBoxUI
. Otherwise, you may lose the features provided by your current L & F.
EDIT:. If you want to get some kind of autocomplete function, it's best to stick with a regular JTextField
and use AutoCompleteDecorator
from SwingX .
source share