javagwtgxt

How to resize display of FramePanel in GXT?


public class View implements IsWidget, EntryPoint {

    @Override
    public void onModuleLoad() {
        // TODO Auto-generated method stub
        RootPanel.get().add(asWidget());
    }

    @Override
    public Widget asWidget() {
        // TODO Auto-generated method stub

        VerticalPanel vp = new VerticalPanel();
        FramedPanel cp = new FramedPanel();
        vp.setBorderWidth(1);
        vp.setWidth("100%");
        vp.setHeight("100%");
        cp.setWidth("100%");
        cp.setHeight("100%");
        vp.add(cp);

        return vp;
    }

I want fill that Frame Panel in VerticalPanel. So I was designate the height and width of the VerticalPanel and FramedPanel as 100%. however, Results were different from expected results.

How to resize display of FramePanel in GXT ?


Solution

  • There are several things you need to take care:

    1) If you want Framed panel to take 100% of verticalPanel, why to use VerticalPanel then.

    2) Do not use GWT widgets with GXT widgets. GXT provides several widgets that can easily help you in layouting your UI. Here is the link to GXT layout containers

    3) If, you wanyt to use VerticalPanel, used VerticalLayoutContainer.

    VerticalLayoutContainer vlc = new VerticalLayoutContainer();
    vlc.add(cp,new VerticalLayoutData(1,1));
    

    It gives 100% of available width and height. See here. In the section getHeight or getWidth.

    Use setResize(true); if you want your framed panel to resize itself