Set background color in Java on a JPanel doesn't work

后端 未结 3 712
我在风中等你
我在风中等你 2020-12-21 02:42

I am working on a \"paint-like\" application (a little drawing software) to familiarize with Java 2D components. Here is my problem: I have a JFrame whose ContentPane is an

3条回答
  •  渐次进展
    2020-12-21 02:53

    This could fix it...

    public class Container extends JPanel
    {
        public Container() 
        {
            super();
            this.setOpaque(true);
            this.setBackground(Color.WHITE);
        }
    }
    

提交回复
热议问题