如何删除JComboBox
下拉箭头的背景,只留下小三角形?下拉列表是使用Netbeans版本8中的JComboBox
工具创建的。
答案 0 :(得分:1)
@Drew我不认为OP希望按钮消失 - 他只是希望按钮没有箭头三角形以外的可见表现形式:
JComboBox<String> box = new JComboBox<>();
final Color bg = box.getBackground();
box.setUI(new BasicComboBoxUI() {
@Override
protected JButton createArrowButton() {
JButton b = super.createArrowButton();
b.setBackground(bg);
b.setBorderPainted(false);
return b;
}
});