當前位置: 首頁>>代碼示例>>Java>>正文


Java ToolBar.setBackground方法代碼示例

本文整理匯總了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;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:32,代碼來源:ColorSelectionWidget.java

示例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;
}
 
開發者ID:debrief,項目名稱:limpet,代碼行數:26,代碼來源:ApplicationWorkbenchWindowAdvisor.java

示例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);
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:22,代碼來源:ValuePointToolTipUI.java

示例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);
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:34,代碼來源:TourInfoUI.java


注:本文中的org.eclipse.swt.widgets.ToolBar.setBackground方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。