本文整理匯總了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);
}