Java – the background color of the selected item in the non editable jcombobox
•
Java
Non editable JCombo@R_382_2419 @The background color selected in is a blue color:
Is there any way to make it a different color, such as white?
Solution
This should work
jCombo@R_382_2419@1.setRenderer(new DefaultListCellRenderer() {
@Override
public void paint(Graphics g) {
setBackground(Color.WHITE);
setForeground(Color.BLACK);
super.paint(g);
}
});
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
