Search code examples
javaswteclipse-rcpjface

How to force a minimum height of a JFace Wizard in Eclipse?


I'm presenting a wizard (code here) that gets too low, so the content does not show completely (see screenshot below):

enter image description here

How can I force the wizard to have a minimum height?

According to the answer on this question here on StackOverflow, the wizard will be the same height as the largest wizardpage in the wizard, but my wizard obvilusly does not get resized according to at least the content of the largest page, and I also tried to set the minimum height of the first visible wizard page with code like this in the WizardPage class:

@Override
public void createControl(Composite parent) {
  // create the composite to hold the widgets
  Composite composite =  new Composite(parent, SWT.NULL);
  composite.setSize(300, 1024); // TODO: Does this work?

  GridData gridData = new GridData(300, 1024);
  gridData.heightHint = 1024;
  gridData.minimumHeight = 1024;
  composite.setLayoutData(gridData);

... but without success so far.

Any hints?


Solution

  • Try to set

    parent.setLayout(new GridLayout());
    

    to your createControl() implementation of your first page.

    It appears the parent you get in that method has an instance of PageContainerFillLayout as layout, not GridLayout.

    If you have access to your WizardDialog, you could also call

    wizardDialog.setMinimumPageSize(300, 1024)