[英]How do you edit a JComboBox dropdown arrow?
How do you remove the background of a JComboBox
dropdown arrow, leaving only the small triangle? 如何删除
JComboBox
下拉箭头的背景,只留下小三角形? The dropdown list was created using the JComboBox
tool in Netbeans version 8. 下拉列表是使用Netbeans版本8中的
JComboBox
工具创建的。
@Drew I don't think the OP wants the button to disappear - he just wants the button to have no visible manifestation other than the arrow triangle: @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;
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.