我可以使用以下方法更改ComboBox背景颜色:
UIManager.put("ComboBox.background", Color.RED);
它有效。
但要更改 [selected] .background ,查看Nimbus Defaults该属性称为 ComboBox:“ComboBox.listRenderer”[Selected] .background ,所以我尝试了:
UIManager.put("ComboBox:\"ComboBox.listRenderer\"[Selected].background", Color.RED);
但它不起作用。
我想用渲染器(我已经尝试过,并且在很长的代码中提出了很多问题,我甚至没有自己写过,如果我这样做,将组合框渲染到JFileChoosers中是一个额外的问题)。那么,有没有解决方案可以使用UIMAnager.put()?
来解决这个问题答案 0 :(得分:1)
设置不同的Color
,而不使用Nimbus defaluts
1 /单独的JComboBox
((JTextField) myJComboBox.getEditor().getEditorComponent())
#setBackground(Color.xxxx);
2 / JFileChooser
从JComponents
(化合物JFileChooser
)中提取所有JComponents
为here,与JList
和{{1}相同}
以JScrooPane
提取所有JComponents
的最安全方式,如您之前发布的关于该here
3 /使用JFileChooser
查找defalut
NimbusDefalut
以及我的添加No.1
JTextField
来自JComboBox's DropDown List
的defaluts,HighLighter可供选择JList
编辑:
码
JTable