当前位置: 首页>>代码示例>>Java>>正文


Java CoolItem.setControl方法代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.CoolItem.setControl方法的典型用法代码示例。如果您正苦于以下问题:Java CoolItem.setControl方法的具体用法?Java CoolItem.setControl怎么用?Java CoolItem.setControl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.widgets.CoolItem的用法示例。


在下文中一共展示了CoolItem.setControl方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createContents

import org.eclipse.swt.widgets.CoolItem; //导入方法依赖的package包/类
protected Control createContents(Composite parent) {
  // --- Create the window title. ---

  getShell().setText("CoolBar Test");

  String asCoolItemSection[] = { "File", "Formatting", "Search" };
  CoolBar composite = new CoolBar(parent, SWT.NONE);
  for (int idxCoolItem = 0; idxCoolItem < 3; ++idxCoolItem) {
    CoolItem item = new CoolItem(composite, SWT.NONE);
    ToolBar tb = new ToolBar(composite, SWT.FLAT);
    for (int idxItem = 0; idxItem < 3; ++idxItem) {
      ToolItem ti = new ToolItem(tb, SWT.NONE);
      ti
          .setText(asCoolItemSection[idxCoolItem] + " Item #"
              + idxItem);
    }
    Point p = tb.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    tb.setSize(p);
    Point p2 = item.computeSize(p.x, p.y);
    item.setControl(tb);
    item.setSize(p2);
  }
  return composite;
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:25,代码来源:SWTCoolBarTestDemo.java

示例2: createToolBar

import org.eclipse.swt.widgets.CoolItem; //导入方法依赖的package包/类
public void createToolBar() {
    Composite compCoolBar = new Composite(shell, SWT.BORDER);
    compCoolBar.setLayout(new FillLayout());

    CoolBar coolBarSort = new CoolBar(compCoolBar, SWT.NONE);

    CoolItem coolItemSort = new CoolItem(coolBarSort, SWT.NONE);

    Combo prjCombo = new Combo(coolBarSort, SWT.READ_ONLY);
    prjCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    prjCombo.setItems(new String[] { "显示所有用例", "只显示成功的用例", "只显示失败的用例" });
    prjCombo.select(0);

    Point p = prjCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    prjCombo.setSize(p);
    Point p2 = coolItemSort.computeSize(p.x, p.y);
    coolItemSort.setSize(p2);
    coolItemSort.setControl(prjCombo);

    coolBarSort.pack();

}
 
开发者ID:hoozheng,项目名称:AndroidRobot,代码行数:23,代码来源:LogAnalysis.java

示例3: dispose

import org.eclipse.swt.widgets.CoolItem; //导入方法依赖的package包/类
/**
 * Disposes the given cool item.
 * 
 * @param item
 *            the cool item to dispose
 */
private void dispose(CoolItem item) {
    if ((item != null) && !item.isDisposed()) {

        item.setData(null);
        Control control = item.getControl();
        // if the control is already disposed, setting the coolitem
        // control to null will cause an SWT exception, workaround
        // for 19630
        if ((control != null) && !control.isDisposed()) {
            item.setControl(null);
            // we created it, we dispose it, see bug 293433
        	control.dispose();
        }
        item.dispose();
    }
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:23,代码来源:CoolBarManager.java

示例4: createToolBar

import org.eclipse.swt.widgets.CoolItem; //导入方法依赖的package包/类
/**
 * 
 */
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();
}
 
开发者ID:dzh,项目名称:jframe,代码行数:21,代码来源:JframeApp.java

示例5: createDialogArea

import org.eclipse.swt.widgets.CoolItem; //导入方法依赖的package包/类
/**
 * Create contents of the dialog.
 * @param parent
 */

@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new GridLayout(1, false));
	
	Shell shell=container.getShell();
	shell.setText("View Transform");
	shell.setImage(ImagePathConstant.APP_ICON.getImageFromRegistry());
	
	CoolBar coolBar = new CoolBar(container, SWT.FLAT);
	coolBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
	
	 CoolItem buttonItem = new CoolItem(coolBar, SWT.NONE | SWT.DROP_DOWN);
	  Composite buttonComposite = new Composite(coolBar, SWT.NONE);
	  buttonComposite.setLayout(new GridLayout(3, false));
	 
	  	createWrapButton(buttonComposite);

	    createCopyButton(buttonComposite);
	    
	    buttonComposite.pack();

	    Point size = buttonComposite.getSize();
	    buttonItem.setControl(buttonComposite);
	    buttonItem.setSize(buttonItem.computeSize(size.x, size.y));

	    createStyleTextEditor(container);
	
		getShell().setMinimumSize(290,290);
		return container;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:37,代码来源:TransformViewDataDialog.java

示例6: createCoolItem

import org.eclipse.swt.widgets.CoolItem; //导入方法依赖的package包/类
private void createCoolItem(final CoolBar coolBar, final ToolBar toolBar) {
    Check.notNull(coolBar, "coolBar"); //$NON-NLS-1$
    Check.notNull(toolBar, "toolBar"); //$NON-NLS-1$

    // Compute the size of the toolbar
    toolBar.pack();
    final Point toolBarSize = toolBar.getSize();

    // Create a CoolItem to hold the toolbar
    final CoolItem coolItem = new CoolItem(coolBar, SWT.NONE);
    coolItem.setControl(toolBar);

    // Set the preferred size to what was computed from the toolbar
    final Point coolItemSize = coolItem.computeSize(toolBarSize.x, toolBarSize.y);

    /*
     * SWT Quirk (Bug?)
     *
     * The cool item should have its PREFERRED size set to the result of its
     * OWN computeSize() calculation, but its MINIMUM size should be set to
     * its "child" TOOL BAR's computed size. I think it should rightly use
     * the same size (its OWN computed size) for minimum size, but this
     * leaves way too much empty space in the right side of the toolbar.
     */
    coolItem.setPreferredSize(coolItemSize);
    coolItem.setMinimumSize(toolBarSize);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:28,代码来源:HTMLEditor.java

示例7: adjustCoolbar

import org.eclipse.swt.widgets.CoolItem; //导入方法依赖的package包/类
public static void adjustCoolbar(ChessBoard board, ToolBar toolbar) {
	clearCoolbar(board);
	toolbar.pack();
	Point size = toolbar.getSize();
	board.getCoolbar().setVisible(true);
	board.getCoolbar().setLocked(true);
	CoolItem coolItem = new CoolItem(board.getCoolbar(), SWT.NONE);
	coolItem.setControl(toolbar);
	coolItem.setSize(size.x, size.y);
	coolItem.setPreferredSize(size.x, size.y);
	coolItem.setMinimumSize(size);
	board.getControl().layout();
}
 
开发者ID:evilwan,项目名称:raptor-chess-interface,代码行数:14,代码来源:ChessBoardUtils.java

示例8: createStatusBar

import org.eclipse.swt.widgets.CoolItem; //导入方法依赖的package包/类
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();
}
 
开发者ID:hoozheng,项目名称:AndroidRobot,代码行数:31,代码来源:LogAnalysis.java

示例9: addBar

import org.eclipse.swt.widgets.CoolItem; //导入方法依赖的package包/类
/**
 * Add a toolbar to the coolBar (sorry, but no pun intended.)
 */
public void addBar(ToolBar b) {
	CoolItem item = new CoolItem(coolBar, SWT.NONE);
	item.setControl(b);
	Point size = b.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	item.setMinimumSize(size);

	coolItems.add(item);
}
 
开发者ID:jakepoz,项目名称:RepDev,代码行数:12,代码来源:MainShell.java

示例10: makeCoolItem

import org.eclipse.swt.widgets.CoolItem; //导入方法依赖的package包/类
private void makeCoolItem(ToolBar toolBar){
	Point size = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	CoolItem coolItem = new CoolItem(this.coolBar, SWT.NONE);
	coolItem.setMinimumSize(size);
	coolItem.setPreferredSize(coolItem.computeSize(size.x, size.y));
	coolItem.setControl(toolBar);
}
 
开发者ID:Totallicks,项目名称:totallicks-tuxguitar,代码行数:8,代码来源:ItemManager.java

示例11: construct

import org.eclipse.swt.widgets.CoolItem; //导入方法依赖的package包/类
public Control construct(Composite parent) {
	final Composite composite = new Composite(parent, SWT.NONE);
	GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL)
			.grab(true, true).applyTo(composite);
	GridLayoutFactory.swtDefaults().numColumns(2).applyTo(composite);
	
	final Text t = new Text(composite, SWT.BORDER | SWT.MULTI);
	t.setText ("Test at the pressing");
	
	CoolBar bar = new CoolBar(composite, SWT.VERTICAL);
	for (int i=1; i<6; i++) {
		CoolItem item = new CoolItem (bar, SWT.NONE);
		final Button button = new Button (bar, SWT.PUSH);
		button.setText ("Button " + i);
		Point size = button.computeSize (SWT.DEFAULT, SWT.DEFAULT);
		item.setPreferredSize (item.computeSize (size.x, size.y));
		item.setControl (button);
		final String t2 = button.getText();
		button.addListener (SWT.Selection, new Listener () {
			public void handleEvent (Event e) {
				t.setText(t2);
			}
		});
	}
	Rectangle clientArea = composite.getClientArea ();
	bar.setLocation (clientArea.x, clientArea.y);

	return null;
}
 
开发者ID:xored,项目名称:q7.quality.mockups,代码行数:30,代码来源:CoolBarTest.java

示例12: addFeatures

import org.eclipse.swt.widgets.CoolItem; //导入方法依赖的package包/类
@Override
   public void addFeatures() {
setWeights(new int[] { 25, 75 });
isoTreeCLabel.setText("Iso explorer");
isoTreeCLabel.setImage(ImageUtils.getInstance().loadImage("iso.png"));
CoolBarManager coolbar = new CoolBarManager(isoTableCoolBar);
ToolBarManager toolbar = new ToolBarManager(SWT.WRAP | SWT.FLAT);

toolbar.add(OpenIsoEntryAction.getInstance());
toolbar.add(GoToIsoEntryParentAction.getInstance());
toolbar.add(ShowIsoInformationAction.getInstance());
toolbar.add(DeleteIsoEntryAction.getInstance());

coolbar.add(toolbar);
coolbar.update(true);
CoolItem coolItem = new CoolItem(isoTableCoolBar, SWT.WRAP | SWT.FLAT);
isoTableText = new Text(isoTableCoolBar, SWT.READ_ONLY | SWT.SINGLE | SWT.BORDER);
isoTableText.pack();
coolItem.setSize(isoTableText.getSize());
coolItem.setControl(isoTableText);

List<String> columnNames = new ArrayList<String>();
{
    columnNames.add("Name");
    columnNames.add("Size");
    columnNames.add("Type");
    columnNames.add("Last Modified Date");
}

List<String> tooltips = new ArrayList<String>();
{
    tooltips.add("Name");
    tooltips.add("Size");
    tooltips.add("Type");
    tooltips.add("Last Modified Date");
}
Iterator<String> it = tooltips.iterator();

for (String columnName : columnNames) {
    TableColumn tvc = new TableColumn(isoDirectoriesTable.getTable(), SWT.LEFT);
    tvc.setText(columnName);
    tvc.setToolTipText(it.next());
    tvc.setWidth(200);
    tvc.setMoveable(true);
    tvc.setResizable(true);
}

isoDirectoriesTable.getTable().setHeaderVisible(true);
isoDirectoriesTree.setContentProvider(new IsoTreeContentProvider());
isoDirectoriesTree.setLabelProvider(new IsoTreeLabelProvider());
isoDirectoriesTree.addFilter(new ShowOnlyIsoDirectoriesFilter());
isoDirectoriesTree.setSorter(new SortByIsoEntryFirstSorter());

isoDirectoriesTable.setContentProvider(new IsoTableProvider());
isoDirectoriesTable.setLabelProvider(new IsoTableProvider());
isoDirectoriesTable.setSorter(new SortByIsoEntryFirstSorter());

GridDataFactory.defaultsFor(isoTreeCLabel).grab(true, false).applyTo(isoTreeCLabel);
GridDataFactory.defaultsFor(isoDirectoriesTree.getControl()).grab(true, true)
	.applyTo(isoDirectoriesTree.getControl());
GridLayoutFactory.fillDefaults().generateLayout(composites.get(0));

GridDataFactory.defaultsFor(isoTableCoolBar).grab(true, false).applyTo(isoTableCoolBar);
GridDataFactory.defaultsFor(isoDirectoriesTable.getControl()).grab(true, true)
	.applyTo(isoDirectoriesTable.getControl());
GridLayoutFactory.fillDefaults().generateLayout(composites.get(1));
   }
 
开发者ID:Cavallinux,项目名称:jisocreator,代码行数:68,代码来源:IsoExplorerSashForm.java

示例13: addFeatures

import org.eclipse.swt.widgets.CoolItem; //导入方法依赖的package包/类
@Override
   public void addFeatures() {
setWeights(new int[] { 25, 75 });
osTreeCLabel.setText("File explorer");
osTreeCLabel.setImage(ImageUtils.getInstance().loadImage("drive.png"));

CoolBarManager coolbar = new CoolBarManager(osTableCoolBar);
ToolBarManager toolbar = new ToolBarManager(SWT.WRAP | SWT.FLAT);

toolbar.add(OpenAction.getInstance());
toolbar.add(GoToParentAction.getInstance());
toolbar.add(RefreshExplorerAction.getInstance());
toolbar.add(AddFileAction.getInstance());
toolbar.add(ShowHiddenFilesAction.getInstance());

coolbar.add(toolbar);
coolbar.update(true);

CoolItem coolItem = new CoolItem(osTableCoolBar, SWT.WRAP | SWT.FLAT);
osTableText = new Text(osTableCoolBar, SWT.READ_ONLY | SWT.SINGLE | SWT.BORDER);
osTableText.pack();
coolItem.setSize(osTableText.getSize());
coolItem.setControl(osTableText);

List<String> tooltips = new ArrayList<String>();
{
    tooltips.add("File name");
    tooltips.add("File size, in bytes");
    tooltips.add("File type");
    tooltips.add("File kast modified date");
}

List<String> columnNames = new ArrayList<String>();
{
    columnNames.add("Name");
    columnNames.add("Size");
    columnNames.add("Type");
    columnNames.add("Last Modified Date");
}
Iterator<String> it = tooltips.iterator();

for (String columnName : columnNames) {
    TableColumn tvc = new TableColumn(osDirectoriesTable.getTable(), SWT.LEFT);
    tvc.setText(columnName);
    tvc.setToolTipText(it.next());
    tvc.setWidth(200);
    tvc.setMoveable(true);
    tvc.setResizable(true);
}
osDirectoriesTable.getTable().setHeaderVisible(true);

osDirectoriesTree.setContentProvider(new OSTreeContentProvider());
osDirectoriesTree.setLabelProvider(new OSTreeLabelProvider());
osDirectoriesTree.addFilter(new ShowOnlyDirectoriesFilter());
osDirectoriesTree.addFilter(new HideHiddenFilesFilter());
osDirectoriesTree.setSorter(new SortByDirectoriesFirstSorter());
osDirectoriesTree.setInput(OSExplorer.getInstance());

osDirectoriesTable.setContentProvider(new OsTableProvider());
osDirectoriesTable.setLabelProvider(new OsTableProvider());
osDirectoriesTable.addFilter(new HideHiddenFilesFilter());
osDirectoriesTable.setSorter(new SortByDirectoriesFirstSorter());

GridDataFactory.defaultsFor(osTreeCLabel).grab(true, false).applyTo(osTreeCLabel);
GridDataFactory.defaultsFor(osDirectoriesTree.getControl()).grab(true, true)
	.applyTo(osDirectoriesTree.getControl());
GridLayoutFactory.fillDefaults().generateLayout(composites.get(0));

GridDataFactory.defaultsFor(osTableCoolBar).grab(true, false).applyTo(osTableCoolBar);
GridDataFactory.defaultsFor(osDirectoriesTable.getControl()).grab(true, true)
	.applyTo(osDirectoriesTable.getControl());
GridLayoutFactory.fillDefaults().generateLayout(composites.get(1));
   }
 
开发者ID:Cavallinux,项目名称:jisocreator,代码行数:74,代码来源:OSExplorerSashForm.java


注:本文中的org.eclipse.swt.widgets.CoolItem.setControl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。