Layout advice

Hi,
I’m struggling with a layout problem and if anyone would be willing to help out i would appreciate it.


public class TestWindow extends Window {

   public TestWindow() {
      
      GridLayout mainGrid = new GridLayout(2, 2);
      
      HorizontalLayout mainhl = new HorizontalLayout();
      HorizontalLayout hl = new HorizontalLayout();
      
      Panel p = new Panel();
      
      Button one = new NativeButton("One");
      Button two = new NativeButton("Two");
      Button three = new NativeButton("three");
      Button four = new NativeButton("four");
      
      hl.addComponent(one);
      hl.addComponent(two);
      hl.addComponent(three);
      hl.addComponent(four);
      //hl.setSizeUndefined();
      
      p.setContent(hl);
      
      mainhl.setWidth("100%");
      mainhl.addComponent(p);
      mainhl.setComponentAlignment(p, Alignment.MIDDLE_CENTER);
      
      mainGrid.addComponent(mainhl);
      mainGrid.setSizeFull();
      setWidth("500px");
      setHeight("500px");
      //setResizable(true);
      setContent(mainGrid);
   }
}