PDA

View Full Version : Changing a Panel Header color



rafkad
21 Aug 2009, 12:22 AM
Hi,

I would like to change the background color of a header panel, but my code below does not work:
public void handleEvent(BaseEvent be) {
ContentPanel cp = (ContentPanel) be.getSource();
Header head = cp.getHeader();
head.setStyleAttribute("backgroundColor", "red");
head.repaint();
}

Thanks
Rafik

Arno.Nyhm
21 Aug 2009, 3:08 AM
did you try it with pure css?

Arno.Nyhm
21 Aug 2009, 3:19 AM
i you look into css with firebug then you see the header background is not set via color but with a image in x-panel-header

so you have to remove the image too:



Header head = cp.getHeader();
head.setStyleAttribute("backgroundColor", "red");
head.setStyleAttribute("backgroundImage", "none"); // <-- remove the image



instead of removing the header image you can swap it to your own colored image ....

rafkad
21 Aug 2009, 5:08 AM
that was it! by removing the image I can see the background color that I set.
Thanks a lot