本文整理汇总了Java中org.eclipse.swt.widgets.ToolBar.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java ToolBar.setBackground方法的具体用法?Java ToolBar.setBackground怎么用?Java ToolBar.setBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.ToolBar
的用法示例。
在下文中一共展示了ToolBar.setBackground方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSingleColors
import org.eclipse.swt.widgets.ToolBar; //导入方法依赖的package包/类
/**
* Create a toolitem to represent a color. In the passed composite will be
* created two element, a label with a text and the toolitem
*
* @param text the text that will be used into the label
* @param parent the composite where the controls will be placed
* @param color the color used to initialize the control
* @return the created toolitem
*/
private ToolItem createSingleColors(String text, Composite parent, AlfaRGB color){
new Label(parent, SWT.NONE).setText(text);
final ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.WRAP | SWT.LEFT);
toolBar.setBackground(parent.getBackground());
final ToolItem foreButton = new ToolItem(toolBar, SWT.PUSH);
setButtonColor(color, foreButton);
foreButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ColorDialog cd = new ColorDialog(toolBar.getShell());
cd.setText(Messages.TableWizardLayoutPage_colorSelectionDialog);
if (foreButton.getData() instanceof AlfaRGB) cd.setRGB((AlfaRGB)foreButton.getData());
AlfaRGB newColor = cd.openAlfaRGB();
if (newColor != null) {
setButtonColor(newColor,foreButton);
selectionChangeButton.widgetSelected(e);
}
}
});
toolBar.pack();
return foreButton;
}
示例2: createEmptyWindowContents
import org.eclipse.swt.widgets.ToolBar; //导入方法依赖的package包/类
public Control createEmptyWindowContents(Composite parent)
{
final IWorkbenchWindow window = getWindowConfigurer().getWindow();
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
Display display = composite.getDisplay();
Color bgCol = display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND);
composite.setBackground(bgCol);
Label label = new Label(composite, SWT.WRAP);
label.setForeground(display
.getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
label.setBackground(bgCol);
label.setFont(JFaceResources.getFontRegistry().getBold(
JFaceResources.DEFAULT_FONT));
String msg = IDEWorkbenchMessages.IDEWorkbenchAdvisor_noPerspective;
label.setText(msg);
ToolBarManager toolBarManager = new ToolBarManager();
// TODO: should obtain the open perspective action from ActionFactory
openPerspectiveAction =
ActionFactory.OPEN_PERSPECTIVE_DIALOG.create(window);
toolBarManager.add(openPerspectiveAction);
ToolBar toolBar = toolBarManager.createControl(composite);
toolBar.setBackground(bgCol);
return composite;
}
示例3: createUI_030_Actions
import org.eclipse.swt.widgets.ToolBar; //导入方法依赖的package包/类
private void createUI_030_Actions(final Composite parent) {
/*
* create toolbar
*/
_toolbarControl = new ToolBar(parent, SWT.FLAT);
GridDataFactory.fillDefaults()//
// .align(SWT.END, SWT.FILL)
.align(SWT.END, SWT.BEGINNING)
.applyTo(_toolbarControl);
_toolbarControl.setForeground(_fgColor);
_toolbarControl.setBackground(_bgColor);
// _toolbarControl.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW));
// _toolbarControl.setBackground(_fgToolbar);
final ToolBarManager tbm = new ToolBarManager(_toolbarControl);
tbm.add(_actionOpenTooltipMenu);
tbm.update(true);
}
示例4: createUI_12_Toolbar
import org.eclipse.swt.widgets.ToolBar; //导入方法依赖的package包/类
private void createUI_12_Toolbar(final Composite container) {
if (_isActionsVisible == false) {
// actions are not enabled
return;
}
/*
* create actions
*/
_actionEditTour = new ActionTourToolTip_EditTour(_tourToolTipProvider, _tourProvider);
_actionEditQuick = new ActionTourToolTip_EditQuick(_tourToolTipProvider, _tourProvider);
_actionPrefDialog = new ActionTourToolTip_EditPreferences(
_tourToolTipProvider,
Messages.Tour_Tooltip_Action_EditFormatPreferences,
PrefPageAppearanceDisplayFormat.ID);
/*
* create toolbar
*/
final ToolBar toolbar = new ToolBar(container, SWT.FLAT);
GridDataFactory.fillDefaults().applyTo(toolbar);
toolbar.setForeground(_fgColor);
toolbar.setBackground(_bgColor);
final ToolBarManager tbm = new ToolBarManager(toolbar);
tbm.add(_actionEditTour);
tbm.add(_actionEditQuick);
tbm.add(_actionPrefDialog);
tbm.update(true);
}