Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making an editor page with sections doesnt work (eclipse, java)

I am trying to create a multipage editor looking similar to the manifest editor. I used the wizard for multipage editors, and tried to make a really really simple page following the tutorial

 void createPage0() {

    Composite composite = new Composite(getContainer(), SWT.DEFAULT);

    FormToolkit toolkit = new FormToolkit(composite.getDisplay());
    ScrolledForm scrollform= toolkit.createScrolledForm(composite);
    scrollform.setText("Test Viewer");

    toolkit.decorateFormHeading(form.getForm());

    int index = addPage(composite);
    setPageText(index, "editor1");
}

If I run this in eclipse, the first page of the editor is plain grey with nothing displayed. (There suppose to be the title according to the tutorial)

Does anyone know why it doesn't work?

like image 558
Hengrui Jiang Avatar asked Feb 04 '26 23:02

Hengrui Jiang


1 Answers

You need to set a layout on the Composite so that it fills the data area:

Composite composite = new Composite(getContainer(), SWT.NONE);

composite.setLayout(new FillLayout());

If you want to use the FormToolkit code a lot then FormEditor provides more support for this.

like image 96
greg-449 Avatar answered Feb 06 '26 12:02

greg-449