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


Java CoolItem.setPreferredSize方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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


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