CoolBar

      CoolBar是一个容器,里面可以放置多个工具栏,CoolItem代表一个工具栏,基于CoolBar做出的工具栏,可以拖动,改变排放的位置。 final ViewForm vf=new ViewForm(shell, SWT.NONE);

		vf.setLayout(new FillLayout());
		
		final Text text=new Text(vf, SWT.BORDER|SWT.V_SCROLL);
		vf.setContent(text);
		
		CoolBar cb=new CoolBar(vf, SWT.NONE);
		
		
		ToolBar tb=new ToolBar(cb, SWT.NONE);
		ToolItem ti=new ToolItem(tb, SWT.PUSH);
		ti.setText("取得");
		ti.addSelectionListener(new SelectionAdapter()
		{
			@Override
			public void widgetSelected(SelectionEvent arg0) {
				// TODO Auto-generated method stub
				MessageDialog.openInformation(null, null, text.getText());
			}
			
		});
		
		
		ToolBar tb2=new ToolBar(cb, SWT.NONE);
		ToolItem ti2=new ToolItem(tb2, SWT.PUSH);
		ti2.setText("删除");
		ti2.addSelectionListener(new SelectionAdapter()
		{
			@Override
			public void widgetSelected(SelectionEvent arg0) {
				text.setText("");
			}
			
		});
		
		CoolItem ci=new CoolItem(cb, SWT.NONE);
		ci.setControl(tb);
		tb.pack();
		Point size=tb.getSize();
		ci.setSize(size);
		ci.setMinimumSize(size);
		
		
		CoolItem ci2=new CoolItem(cb, SWT.NONE);
		ci2.setControl(tb2);
		tb2.pack();
		Point size2=tb2.getSize();
		ci2.setSize(size2);
		ci2.setMinimumSize(size2);
		
		vf.setTopLeft(cb);
		
		cb.addControlListener(new ControlAdapter()
		{
			
			@Override
			public void controlResized(ControlEvent arg0) {
				vf.layout();
			}
			
		});
		
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值