How to change the background color on a Java panel?

后端 未结 4 824

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 16:43

    setBackground() is the right method to use. Did you repaint after you changed it? If you change it before you make the panel (or its containing frame) visible it should work

提交回复
热议问题