Wednesday, September 1, 2010

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

First, I think you want to use DockLayoutPanel, not DockPanel.

Next, you have to specify the size of each of the panels that you're
adding except the center... i.e. <g:north size="3">

Then you want to add the dock panel to a RootLayoutPanel, not the
RootPanel.

On Aug 31, 8:44 pm, gwt hanasaki <hanas...@gmail.com> wrote:
> 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