本文整理匯總了Java中org.eclipse.swt.widgets.ToolBar.computeSize方法的典型用法代碼示例。如果您正苦於以下問題:Java ToolBar.computeSize方法的具體用法?Java ToolBar.computeSize怎麽用?Java ToolBar.computeSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.ToolBar
的用法示例。
在下文中一共展示了ToolBar.computeSize方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createContents
import org.eclipse.swt.widgets.ToolBar; //導入方法依賴的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;
}
示例2: updateToolbarSize
import org.eclipse.swt.widgets.ToolBar; //導入方法依賴的package包/類
public static void updateToolbarSize(ToolBar tb, Rectangle clientArea) {
if (tb == null)
return;
Point size = tb.computeSize(SWT.DEFAULT, clientArea.height);
// logger.debug("tb1 size: "+size);
tb.setSize(size);
}
示例3: computeDefaultTrimHeight
import org.eclipse.swt.widgets.ToolBar; //導入方法依賴的package包/類
private int computeDefaultTrimHeight() {
int result;
Shell shell = new Shell( getDisplay(), SWT.NONE );
try {
ToolBar toolBar = new ToolBar( shell, SWT.NONE );
ToolItem toolItem = new ToolItem( toolBar, SWT.PUSH );
toolItem.setImage( JFaceResources.getImageRegistry().get( Dialog.DLG_IMG_MESSAGE_INFO ) );
int toolItemHeight = toolBar.computeSize( SWT.DEFAULT, SWT.DEFAULT ).y;
result = Math.max( toolItemHeight, measureText( "Wg" ).y );
} finally {
shell.dispose();
}
return result;
}