PDA

View Full Version : Transparent BG on ContentPanel



LINEMAN78
9 Dec 2008, 4:35 PM
I was using a layoutContainer on my main page, which is a BorderLayout, but for some reason when I updated to 1.2 it would expand the section to a size that is a lot bigger than my LayoutData is set for. I put a ContentPanel in it's place and it works fine, but I need it to be transparent like the LayoutContainer. I have tried the following and it does not work.



ContentPanel north = new ContentPanel();
north.setHeaderVisible(false);
north.setBodyBorder(false);
north.setBorders(false);
north.setFooter(false);
north.setFrame(false);
north.setStyleAttribute("backgroundColor", "transparent");
BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, 30);
northData.setMaxSize(30);
northData.setSize(30);
northData.setMinSize(30);


UPDATE: I have solved my problem with the rendering of the BorderLayout (It had something to do with the order in which I was initializing stuff), but am still interested in being able to change the background color of a ContentPanel

karacutey
9 Dec 2008, 5:36 PM
that would be a nice method

edfimasa
10 Dec 2008, 7:07 AM
Well for the header it's like this
cp.getHeader().setStyleAttribute("background", "#CCFFCC");

but for the rest of the "dragon" i don't remember :S i think i did it once.

Cheers.

beab1802
18 Feb 2009, 5:28 AM
could you explain your solution with rendering borderLayout.


Thanks

LINEMAN78
18 Feb 2009, 12:38 PM
I don't remember how I did it, so here is my constructor of my class that extends LayoutContainer that is added to a Viewport that has been set to FitLayout


setLayout(new BorderLayout());

LayoutContainer north = new LayoutContainer();
HorizontalPanel northPanel = new HorizontalPanel();
northPanel.setWidth("100%");
northPanel.add(logo);
north.add(northPanel);

ContentPanel centerWrapper = new ContentPanel();
centerWrapper.setHeaderVisible(false);
centerWrapper.setBodyBorder(false);
centerWrapper.setBorders(false);
centerWrapper.setFooter(false);
centerWrapper.setFrame(false);
centerWrapper.setScrollMode(Scroll.AUTOY);

WestPanel west = new WestPanel();
west.menu.addListener(this);

BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, 30);
BorderLayoutData westData =
new BorderLayoutData(LayoutRegion.WEST, 200, 100, 300);
westData.setMargins(new Margins(5, 0, 5, 5));
westData.setCollapsible(true);
centerData.setMargins(new Margins(5));
BorderLayoutData centerData =
new BorderLayoutData(LayoutRegion.CENTER);
BorderLayoutData southData2 = new BorderLayoutData(LayoutRegion.SOUTH, 50);

add(north, northData);
add(west, westData);
add(centerWrapper, centerData);
add(RSSHorizontalTicker.getInstance(Config.RSS_FEED_URL), southData2);