I would like to change the background of my JLabel
in a JScrollPane
's RowHeaderView
.
JLabel jl = new JLabel("asdfasdfasdf");
jl.setForeground(Color.RED);
JScrollPane scroll = new JScrollPane();
// I Have tried
jl.setBackground(new Color(0, 0, 0, 255));
scroll.setBackground(new Color(0, 0, 0, 255));
scroll.setOpaque(true);
scroll.setVisible(true);
scroll.setRowHeaderView(jl);
However the text is red but the background remains white.
EDIT
This is a duplicate of How do I set a JLabel's background color?, however I cannot set this question as a duplicate myself as I require 250 rep.