Java Code Examples for org.eclipse.swt.widgets.CoolBar#setLayoutData()

The following examples show how to use org.eclipse.swt.widgets.CoolBar#setLayoutData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BarManager.java    From pmTrans with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void createToolBar() {
	bar = new CoolBar(shell, SWT.FLAT | SWT.TOP);
	// bars
	bar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

	createFileSection();
	createEditBar();
	createFontSection();
	createSettingsBar();

	bar.pack();
	bar.addListener(SWT.Resize, new Listener() {

		@Override
		public void handleEvent(Event arg0) {
			pmTrans.adjustLayout();
		}
	});
}
 
Example 2
Source File: JframeApp.java    From jframe with Apache License 2.0 6 votes vote down vote up
/**
 * 
 */
protected void createToolBar() {
    CoolBar bar = new CoolBar(shell, SWT.FLAT);
    bar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    bar.setLayout(new RowLayout());

    CoolItem item = new CoolItem(bar, SWT.NONE);
    Button button = new Button(bar, SWT.FLAT);
    // button.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true));
    button.setText("Button");
    Point size = button.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    item.setPreferredSize(item.computeSize(size.x, size.y));
    item.setControl(button);

    Rectangle clientArea = shell.getClientArea();
    bar.setLocation(clientArea.x, clientArea.y);
    bar.pack();
}
 
Example 3
Source File: LogAnalysis.java    From AndroidRobot with Apache License 2.0 5 votes vote down vote up
private void createStatusBar() {
    coolBar1 = new CoolBar(shell, SWT.NONE);
    FormData formData1 = new FormData();
    formData1.left = new FormAttachment(0, 0);
    formData1.right = new FormAttachment(100, 0);
    formData1.top = new FormAttachment(100, -24);
    formData1.bottom = new FormAttachment(100, 0);
    coolBar1.setLayoutData(formData1);
    CoolItem coolItem1 = new CoolItem(coolBar1, SWT.NONE);
    toolBar1 = new ToolBar(coolBar1, SWT.NONE);

    ToolItem tiStatusBarTotal = new ToolItem(toolBar1, SWT.NONE);
    ToolItem tiStatusBarPass = new ToolItem(toolBar1, SWT.NONE);
    ToolItem tiStatusBarFail = new ToolItem(toolBar1, SWT.NONE);
    ToolItem tiStatusBarRate = new ToolItem(toolBar1, SWT.NONE);

    tiStatusBarPass.setText("通过:0");
    tiStatusBarFail.setText("失败:0");
    tiStatusBarRate.setText("通过率:0%");
    tiStatusBarTotal.setText("总用例数:0");

    coolItem1.setControl(toolBar1);

    Control control = coolItem1.getControl();
    Point pt = control.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    pt = coolItem1.computeSize(pt.x, pt.y);
    coolItem1.setSize(pt);

    coolBar1.pack();
}