SWT Tips and Samples 基礎編 > ToolBar

 

ToolBar

ToolBarコンストラクタのスタイル指定により、通常の概観のToolBarとポインタが上にあるときのみボタンが浮くあがるFlat型のToolBarを作り分けることができます。

スクリーンショット

ソースコード (ToolBarTest.java)

import org.eclipse.swt.widgets.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.*;

public class ToolBarTest {

        public static void main(String[] args) {
                new ToolBarTest();
        }
        public ToolBarTest() {
                Display display = new Display();
                Shell shell = new Shell(display);
                shell.setText("ToolBarTest");

                shell.setLayout(new FillLayout(SWT.VERTICAL));
                
                //----- ToolBar1
                ToolBar tb1 = new ToolBar(shell, SWT.NONE);
                
                ToolItem item1 = new ToolItem(tb1, SWT.PUSH);
                item1.setText("Push");
                
                ToolItem item2 = new ToolItem(tb1, SWT.SEPARATOR);
                
                ToolItem item3 = new ToolItem(tb1, SWT.CHECK);
                item3.setText("Check");
                
                ToolItem item4 = new ToolItem(tb1, SWT.RADIO);
                item4.setText("Radio");
                
                //----- ToolBar2
                ToolBar tb2 = new ToolBar(shell, SWT.FLAT);
                ToolItem item5 = new ToolItem(tb2, SWT.PUSH);
                item5.setText("Push");
                
                ToolItem item6 = new ToolItem(tb2, SWT.SEPARATOR);
                
                ToolItem item7 = new ToolItem(tb2, SWT.CHECK);
                item7.setText("Check");
                
                ToolItem item8 = new ToolItem(tb2, SWT.RADIO);
                item8.setText("Radio");         

                shell.pack();
                shell.open();
                while (!shell.isDisposed()) {
                        if (!display.readAndDispatch()) {
                                display.sleep();
                        }
                }
                display.dispose();
        }
}


最新更新日: 2004年9月1日
 
関連リンク
Eclipse API ドキュメント

- PR -

プレゼンテーション作成ソフト無料お試し版配信中

【Sony】大手他社よりも安い!ビジネス向け光・100Mしかも固定IP付!今なら更に初期費用最大15,000円OFF!

オフィス用品・オフィス家具 価 格 交 渉 可! 
◎ 目指せ★業界最安値 ★ ◎ オフィネット・ドットコム株式会社

注文から納品まで驚きの早さ!!【ASKULカタログ】はこちらから・・・

マイクロソフト お得な見積! まとめての購入ならオトクな方法で。ライセンスだから管理も簡単。


Copyright(C) 2003,2004 Jasmin Project. All Right Reserved.
SEO [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送