Java2d: JPanel set background color not working
Posted
by Algorist
on Stack Overflow
See other posts from Stack Overflow
or by Algorist
Published on 2010-05-14T00:53:38Z
Indexed on
2010/05/14
1:04 UTC
Read the original article
Hit count: 539
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.
© Stack Overflow or respective owner