use of javax.swing.plaf.basic.BasicComboBoxUI in project java-swing-tips by aterai.
the class MainPanel method makeComboBox.
private static JComboBox<String> makeComboBox() {
JComboBox<String> combo = new JComboBox<String>(new String[] { "Name 0", "Name 1", "Name 2" }) {
@Override
public void updateUI() {
super.updateUI();
setBorder(BorderFactory.createEmptyBorder());
setUI(new BasicComboBoxUI() {
@Override
protected JButton createArrowButton() {
JButton button = super.createArrowButton();
button.setContentAreaFilled(false);
button.setBorder(BorderFactory.createEmptyBorder());
return button;
}
});
// JTextField editor = (JTextField) getEditor().getEditorComponent();
// editor.setBorder(BorderFactory.createEmptyBorder());
// editor.setOpaque(true);
// editor.setEditable(false);
}
};
//combo.setEditable(true);
return combo;
}
Aggregations