Tuesday, August 31, 2010

How to make a dockpanel center take up the whole center? like swing does?

The below code makes a "center" in a yellowish color as desired
however
- EAST is only as high as the text
- CENTER is just a small box not the whole center that grows/shrinks
as the browser is resized.

code below

public class DemoEntryPoint
implements EntryPoint {

/**
* This is the entry point method.
*/
@Override
public void onModuleLoad() {
DockPanel dockpanel = new DockPanel();
dockpanel.setWidth("100%");


HorizontalPanel headerPanel = new HorizontalPanel();
headerPanel.setWidth("100%");
headerPanel.setHeight("100%");
headerPanel.add(new Label("Title Header"));
dockpanel.add(headerPanel, DockPanel.NORTH);


final Label label1 = new Label("dynamic website : demo :
2010");
dockpanel.add(label1, DockPanel.SOUTH);

String text1 = "Lorem ipsum dolor sit amet...";
String text2 = "Sed egestas, arcu nec accumsan...";
String text3 = "Proin tristique, elit at blandit...";
StackPanel stackMenuPanel = new StackPanel();
Label label;
label = new Label(text1);
stackMenuPanel.add(label, "One", false);
label = new Label(text2);
stackMenuPanel.add(label, "Two", false);
label = new Label(text3);
stackMenuPanel.add(label, "Three", false);
stackMenuPanel.setSize("1.75in", "3in");
stackMenuPanel.addStyleName("demo-panel");

dockpanel.add(stackMenuPanel, DockPanel.WEST);


Panel eastPanel = new SimplePanel();
eastPanel.add(new Label("D"));
eastPanel.setHeight("100%");
eastPanel.setWidth("100px");
dockpanel.add(eastPanel, DockPanel.EAST);

DockPanel pp = new DockPanel();
Panel center = new HorizontalPanel();
// center.setTitle("adsfasfasf");
center.add(new Label("center"));
center.setWidth("100%");
center.setHeight("100%");
pp.add(center, DockPanel.CENTER);
dockpanel.add(pp,DockPanel.CENTER);


RootPanel.get().add(dockpanel);
}
}

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment