Click to See Complete Forum and Search --> : Background Color of a Panel
Jan Meeuwesen
March 6th, 2000, 02:46 AM
Hi there,
I've got a little problem setting the background color of a panel. I've got a Frame which layout is set to null. When I add a panel with a checkboxgroup, and use setBackground(Color.red). The panel is not red only the background of the checkboxes is red.
Can you help me?
Thanx,
Jan Meeuwesen.
DHunter21
March 7th, 2000, 07:38 PM
Jan,
Can you post the code? Or email me with the problem if its a concern.
It sounds like you are setting the background of the checkbox to red, but I'm sure you would have noticed that.
Dustin
Jan Meeuwesen
March 8th, 2000, 02:38 AM
Hi there and thanx for responding,
I've found out something myselve. If I run my program, I see only colors behing the checkboxes. But if I minimize the window and maximize it again, Then the colors are perfect !! ?? I guess when I open my program java just does not take the time to make the background good. Any ideas???
This is the piece of code I use for setting the color of my Panels:
leftPanel = new Panel(null);
leftPanel.setBackground(Color.gray);
leftPanel.setBounds(0,0,200,400);
middlePanel = new Panel(null);
middlePanel.setBackground(Color.darkGray);
middlePanel.setBounds(200,0,200,400);
rightPanel = new Panel(null);
rightPanel.setBackground(Color.gray);
rightPanel.setBounds(400,0,200,400);
Thanx,
Jan Meeuwesen
i.kallur
March 29th, 2001, 02:50 AM
Try this: first you hide the panel and then you
show it. Whith this you repaint the panel and
when you minimize and maximize it will be repainted too. And with this metod it will be the same i think.
leftPanel.setVisible(false);
leftPanel .setVisible(true);
If your panels laying in another panel
changes "leftpanel" to that panels name.
IK
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.