質問

I have a child window, containing a form, Labels, Combos, Buttons aligned in a line, line by line. Form is not finite. There is a button for adding extra line of input fields. It sort of works for the moment... Problem is when the new line is added the child window size remains the same, however I want it to resize automatically.

child window is a standard SWT shell

Shell ConstantEditWindow = new Shell(parent);

I hava a button with sth like this:

addDesc.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {

            populateConstantMain(tariffConstantsOfType, descComp, descCompLayout, true);

            ConstantEditWindow.layout();

        }
    });

but id doesnt work :/ the child window wont resize ;(

役に立ちましたか?

解決

Read this: http://www.eclipse.org/articles/article.php?file=Article-Understanding-Layouts/index.html

And the api: http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fswt%2Fwidgets%2Fpackage-summary.html

  • .layout() layouts the children of a control
  • pack() causes the receiver to be resized to it's preferred size.

Also convention has it that constant name in java should be ALL_IN_CAPITAL.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top