本文整理匯總了Java中org.eclipse.swt.widgets.ToolItem.addListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ToolItem.addListener方法的具體用法?Java ToolItem.addListener怎麽用?Java ToolItem.addListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.ToolItem
的用法示例。
在下文中一共展示了ToolItem.addListener方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createContent
import org.eclipse.swt.widgets.ToolItem; //導入方法依賴的package包/類
private void createContent() {
toolBar = new ToolBar(this, SWT.HORIZONTAL);
toolBar.setEnabled(false);
GridLayout layout = new GridLayout();
GridData layoutData = new GridData(SWT.FILL, SWT.TOP, true, false);
toolBar.setLayout(layout);
toolBar.setLayoutData(layoutData);
ToolItem cancelProcessToolItem = new ToolItem(toolBar, SWT.PUSH);
cancelProcessToolItem.setText(resourceBundle.getString("cancel_process"));
cancelProcessToolItem.addListener(SWT.Selection, event -> {
listeners.forEach(DBProcessInfoViewListener::dbProcessInfoViewCancelProcessToolItemClicked);
});
ToolItem terminateProcessToolItem = new ToolItem(toolBar, SWT.PUSH);
terminateProcessToolItem.setText(resourceBundle.getString("kill_process"));
terminateProcessToolItem.addListener(SWT.Selection, event -> {
listeners.forEach(DBProcessInfoViewListener::dbProcessInfoViewTerminateProcessToolItemClicked);
});
processInfoText = new Text(this, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL);
GridData textLayoutData = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
textLayoutData.heightHint = 200;
processInfoText.setLayoutData(textLayoutData);
}
示例2: addItemToToolBar
import org.eclipse.swt.widgets.ToolItem; //導入方法依賴的package包/類
private ToolItem addItemToToolBar(ToolBar bar, String text, String toolTip,
int type, Listener listener, Image icon) {
ToolItem item = addItemToToolBar(bar, text, toolTip, type);
if (listener != null)
item.addListener(SWT.Selection, listener);
if (icon != null)
item.setImage(icon);
return item;
}