0
我想更改我的JLabel
的背景,其格式爲JScrollPane
的RowHeaderView
。JScrollPane背景中的JLabel不更改
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);
但是文字是紅色的,但背景仍然是白色。
編輯
這是How do I set a JLabel's background color?重複,但我無法設置這個問題作爲一個重複自己,因爲我需要250代表。
'jl.setOpaque(true);'? –
哦......不......我錯過了......請在下面回答。 –
http://stackoverflow.com/questions/2380314/how-do-i-set-a-jlabels-background-color – Husam