トップ 差分 一覧 ソース 検索 ヘルプ RSS ログイン

ExpandBar

ExpandBar

ExpandBarはEclipse 3.2で新たに追加されたコンポーネントで、Windowsのエクスプローラの左側に表示されているような折りたたみ可能な領域を提供します。

ExpandBarはTabFolderなどと同様に、配下にExpandItemを追加することで領域を追加していきます。それぞれの領域に表示する内容はExpandItemのsetControl()メソッドで設定します。また、ExpandItemにはsetHeight()メソッドで領域の高さを設定する必要がある点に注意してください。

ExpandBar expandBar = new ExpandBar(shell, SWT.V_SCROLL);

ExpandItem item1 = new ExpandItem(expandBar, SWT.NULL);
item1.setText("Item1");

Composite composite = new Composite(expandBar, SWT.NULL);
composite.setLayoutData(new GridLayout(3, false));

Label label = new Label(composite, SWT.NULL);
label.setText("単語:");

Text text = new Text(composite, SWT.BORDER|SWT.FLAT);
text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

Button button = new Button(composite, SWT.PUSH);
button.setText("検索");

item1.setControl(composite);
item1.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);

ExpandItem item2 = new ExpandItem(expandBar, SWT.NULL);
item2.setText("Item2");

上記のコードは以下のような表示になります。

最終更新時間:2006年10月03日 07時50分16秒