title: com.vaadin.server.ServiceException: java.lang.NullPointerException
body: <p>Please can you help with: </p>
  
  <pre><code>com.vaadin.server.ServiceException: java.lang.NullPointerException
  </code></pre>
  
  <p>it crashes <code>mainLayout.setWidth("100%");</code> </p>
  
  <pre><code>//***************************************
  private void createUI() {
      final Window mainWindow = new Window("Raspberry Pi GPIO Control Center");
      VerticalLayout mainLayout = (VerticalLayout) mainWindow.getContent();
      setContent(mainLayout);
      System.out.println("1");
      mainLayout.setWidth("100%");
      System.out.println("2");
      mRefresher = new Refresher();
      mRefresher.setRefreshInterval(RefreshIntervalMilliSec);
      mRefresher.addListener(new RefreshListener() {
          private static final long serialVersionUID = 1L;
  
          @Override
          public void refresh(Refresher source) {
              periodicRefresh();
          }
      });
      mainLayout.addComponent(mRefresher);
      createTitle(mainLayout);
      mMainContentLayout = new VerticalLayout();
      mMainContentLayout.setWidth("100%");
      mainLayout.addComponent(mMainContentLayout);
      mainLayout.setComponentAlignment(mMainContentLayout, Alignment.MIDDLE_CENTER);
      createUIForUser();
  }
  //***************************************
  </code></pre>