Top / SWT / CoolBarの使い方

CoolBar?

02.png

CoolBar?とはマウスでドラッグ可能なツールバーです。他のウィジェットとの構成はこのようになっています。

01.png

スニペット

// CoolBarを作成
final CoolBar coolBar = new CoolBar(shell, SWT.NONE);
coolBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
{
  final CoolItem coolItem1 = new CoolItem(coolBar, SWT.PUSH);
  coolItem1.setText("coolItemの1");
  {
    final ToolBar toolBar = new ToolBar(coolBar, SWT.FLAT);
    coolItem1.setControl(toolBar);
    {
      final ToolItem toolItem = new ToolItem(toolBar, SWT.NONE);
      toolItem.setText("アイテム1-1");
    }
    {
      final ToolItem toolItem = new ToolItem(toolBar, SWT.PUSH);
      toolItem.setText("アイテム1-2");
    }
    Point point = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    point = coolItem1.computeSize(point.x, point.y);
    coolItem1.setSize(point);
  }
}
{
  final CoolItem coolItem2 = new CoolItem(coolBar, SWT.PUSH);
  coolItem2.setText("coolItemの2");
  {
    toolBar = new ToolBar(coolBar, SWT.FLAT);
    coolItem2.setControl(toolBar);
    {
      final ToolItem toolItem = new ToolItem(toolBar, SWT.DROP_DOWN);
      toolItem.setText("アイテム2-1");
    }
    {
      final ToolItem toolItem = new ToolItem(toolBar, SWT.PUSH);
      toolItem.setText("アイテム2-2");
    }
    Point point = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    point = coolItem2.computeSize(point.x, point.y);
    coolItem2.setSize(point);
  }
}

この記事は

選択肢 投票
おもしろかった 6  
そうでもない 3  

Top / SWT / CoolBarの使い方

現在のアクセス:7885


添付ファイル: file02.png 845件 [詳細] file01.png 807件 [詳細]

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2012-12-20 (木) 09:47:28 (4138d)