title: SWT: How to get a Composite to automatically fill it's container
body: <p>In the following code I use SWT and also draw2d.  When I run the program however nothing shows up.  After some debugging I've found it to be because the container's size are all 0. I have to manually enter a size like</p>
  
  <pre><code>    canvasData.heightHint = 500;
      canvasData.widthHint = 500;
  </code></pre>
  
  <p>This is fine and dandy but I need these containers to fit themselves into the space given to them by form.  Is there any way to accomplish this? Any advice would be helpful.</p>
  
  <pre><code>/* (non-Javadoc)
   * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
   */
  @Override
  protected void createFormContent( IManagedForm managedForm ) 
  {
      super.createFormContent(managedForm);
  
      ScrolledForm form = managedForm.getForm();  
  
      Composite tabParent = managedForm.getToolkit().createComposite(form.getBody());
      GridData tabParentData = new GridData(SWT.FILL,SWT.FILL,true,true);
      tabParent.setLayoutData(tabParentData);
      tabParent.setLayout(new GridLayout());
  
      FigureCanvas canvas = new FigureCanvas(tabParent);
      GridData canvasData = new GridData(SWT.FILL,SWT.FILL,true,true);        
      canvas.setLayoutData(canvasData);
  
      //diagramContents is an IFigure from draw2d. it holds other IFigures, Labels, ect. 
      //Essentially everything being displayed
      canvas.setContents(diagramContents); 
  
      //This method is what creates everything being displayed (the stuff in diagramContents)
      refreshDisplayFromModel();
  
      canvas.pack();  
      tabParent.pack();   
  }
  </code></pre>