title: Vaadin - center custom component
body: <p>Using Grails 2.3.9 and Vaadin plugin 7.3.9  </p>
  
  <pre><code>class MyUI extends UI {
  
      @Override
      protected void init(VaadinRequest vaadinRequest) {
          VerticalLayout layout = new VerticalLayout()
          layout.setMargin(true)
  
          SignInForm signInForm = new SignInForm()
  
          layout.addComponent(signInForm)
  
          layout.setComponentAlignment(signInForm, Alignment.MIDDLE_CENTER)
  
          layout.setSizeFull()
          setContent(layout)
  
      }
  }
  </code></pre>
  
  <p>Custom component  </p>
  
  <pre><code>class SignInForm extends CustomComponent {
      Panel p = new Panel()
  
      public SignInForm() {
          p.setSizeUndefined()
  
          Label label = new Label("test");
          p.setContent(label);
  
          setCompositionRoot(p);
      }
  }
  </code></pre>
  
  <p>This is how it looks:</p>
  
  <p><img src="https://i.stack.imgur.com/024mm.png" alt="enter image description here"></p>
  
  <p>How can I center the custom component horizontally?  </p>