Search code examples
javagwtextjsgxt

how to create 2 content panels in north widget


can we create 2 content panels in north widget.

BorderLayoutContainer con = new BorderLayoutContainer();
ContentPanel cp = new ContentPanel();
VerticalLayoutContainer logoLayout = new VerticalLayoutContainer();
BorderLayoutData d = new BorderLayoutData(.20);
d.setMargins(new Margins());
Image logo = new Image("/IMAGES/Logo.png");
logoLayout.add(logo);
cp.add(logoLayout);
cp.setHeaderVisible(false);
con.setNorthWidget(cp, d);

please suggest me how to create two content panels.

Basically what I need to do is - please look into the image and let me know what I can do for that

enter image description here


Solution

  • You create your two panels within a single panel, and then assign that single panel to NORTH. Remember that your overall layout can be created from nested layouts.

    ContentPanel cp = new ContentPanel();
    JPanel panelA = new JPanel();
    JPanel panelB = new JPanel();
    JPanel panelBig = new JPanel();
    
    panelBig.add(panelA);
    panelBig.add(panelB);
    cp.add(panelBig, BorderLayout.NORTH);
    

    I think you can probably work out the rest of the details on your own.