How to change the background color on a Java panel?

后端 未结 4 823

Right now, the background I get is a grey. I want to change it to black. I tried doing something like setBackground(color.BLACK); but it didnt work. Any suggestions?

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-07 17:05

    I am assuming that we are dealing with a JFrame? The visible portion in the content pane - you have to use jframe.getContentPane().setBackground(...);

提交回复
热议问题