0

フォーム、ラベル、コンボ、ボタンを1行ずつ並べた子ウィンドウがあります。形は有限ではありません。入力フィールドの行を追加するためのボタンがあります。今のところうまくいきます...問題は、新しい行が追加されたときに子ウィンドウのサイズが同じままであることですが、自動的にサイズを変更したいです。

子ウィンドウは標準の SWT シェルです

Shell ConstantEditWindow = new Shell(parent);

次のような sth のボタンがあります。

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

            populateConstantMain(tariffConstantsOfType, descComp, descCompLayout, true);

            ConstantEditWindow.layout();

        }
    });

しかし、idは機能しません:/子ウィンドウのサイズは変更されません;(

4

1 に答える 1

0

これを読んでください:http ://www.eclipse.org/articles/article.php?file = Article-Understanding-Layouts / index.html

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

  • .layout()は、コントロールの子をレイアウトします
  • pack()を使用すると、レシーバーのサイズが適切なサイズに変更されます。

また、慣例では、Javaの定数名はALL_IN_CAPITALである必要があります。

于 2012-05-27T02:27:51.450 に答える