Java2d: JPanel set background color not working
- by Algorist
I am having the below code.
public VizCanvas(){
{
this.setBackground(Color.black);
this.setSize(400,400);
}
}
It worked fine and displays the panel in black background. But when I implement the paint method, which does nothing, the color changes to default color i.e gray.
I tried to set graphics.setColor() but it didn't help.
Thank you.