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


Java CLabel.setForeground方法代碼示例

本文整理匯總了Java中org.eclipse.swt.custom.CLabel.setForeground方法的典型用法代碼示例。如果您正苦於以下問題:Java CLabel.setForeground方法的具體用法?Java CLabel.setForeground怎麽用?Java CLabel.setForeground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.swt.custom.CLabel的用法示例。


在下文中一共展示了CLabel.setForeground方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createContextButton

import org.eclipse.swt.custom.CLabel; //導入方法依賴的package包/類
protected CLabel createContextButton (String text, Image icon)
{
	CLabel lbl = new CLabel(buttonsContainer, SWT.NONE);
	lbl.setLayoutData(new RowData(SWT.DEFAULT, 28));
	lbl.setRightMargin(10);
	lbl.setLeftMargin(8);
	lbl.setText(text);
	lbl.setImage(icon);
	lbl.setBackground(ColorResources.COLOR_CS_BLUE);
	lbl.setForeground(ColorResources.COLOR_WHITE);
	lbl.setCursor(new Cursor(getDisplay(), SWT.CURSOR_HAND));
	
	contextButtonsMap.put(lbl, text);
	
	return lbl;
}
 
開發者ID:CloudScale-Project,項目名稱:Environment,代碼行數:17,代碼來源:TitleWidget.java

示例2: createErrorComposite

import org.eclipse.swt.custom.CLabel; //導入方法依賴的package包/類
protected void createErrorComposite(final Composite parent) {
    errorMessageText = new CLabel(parent, SWT.NONE);
    errorMessageText.setLeftMargin(0);
    errorMessageText.setText("");

    final GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.heightHint = 30 * getErrorLine();
    gridData.horizontalSpan = numColumns;

    errorMessageText.setLayoutData(gridData);
    errorMessageText.setForeground(ColorConstants.red);
}
 
開發者ID:roundrop,項目名稱:ermasterr,代碼行數:14,代碼來源:AbstractDialog.java

示例3: createLabel

import org.eclipse.swt.custom.CLabel; //導入方法依賴的package包/類
protected void createLabel(DomainStatus status) {
	label = new CLabel(this, SWT.NONE);
	label.setFont(DOMAIN_STATUS_FONT);
	label.setBackground(ColorConstants.white);
	label.setForeground(getSeverityColor(status.getSeverity()));
	label.setImage(getSeverityImage(status.getSeverity()));
}
 
開發者ID:Yakindu,項目名稱:statecharts,代碼行數:8,代碼來源:DomainStatusLabel.java

示例4: updateLabels

import org.eclipse.swt.custom.CLabel; //導入方法依賴的package包/類
/**
 * Updates all step labels.
 */
private void updateLabels() {
	Color activeColor = getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND);
	Color inactiveColor = getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);

	for (CLabel stepLabel : stepLabels) {
		Step step = (Step)stepLabel.getData();
		
		stepLabel.setFont(getFont());
		stepLabel.setForeground(step.isCompleted ? activeColor : inactiveColor);
		// Step has error
		if (step.getState() == StepState.ERROR) {
			stepLabel.setImage(bulletError);
		}
		// Step is successful
		else if (step.getState() == StepState.SUCCESS) {
			stepLabel.setImage(bulletChecked);
		}
		// Step is current
		else if (step.isCurrent()) {
			stepLabel.setImage(bulletArrow);
			stepLabel.setFont(currentFont);
		}
		// Step is completed
		else if (step.isCompleted()) {
			stepLabel.setImage(bulletSolid);
		}
		// Step is not completed
		else {
			stepLabel.setImage(bulletEmpty);
		}
	}
	stepsArea.layout(true);
}
 
開發者ID:MentorEmbedded,項目名稱:p2-installer,代碼行數:37,代碼來源:SideBarComposite.java

示例5: createToolTipContentArea

import org.eclipse.swt.custom.CLabel; //導入方法依賴的package包/類
/**
 * Creates the content are of the the tooltip. By default this creates a
 * CLabel to display text. To customize the text Subclasses may override the
 * following methods
 * <ul>
 * <li>{@link #getStyle(Event)}</li>
 * <li>{@link #getBackgroundColor(Event)}</li>
 * <li>{@link #getForegroundColor(Event)}</li>
 * <li>{@link #getFont(Event)}</li>
 * <li>{@link #getImage(Event)}</li>
 * <li>{@link #getText(Event)}</li>
 * <li>{@link #getBackgroundImage(Event)}</li>
 * </ul>
 * 
 * @param event
 *            the event that triggered the activation of the tooltip
 * @param parent
 *            the parent of the content area
 * @return the content area created
 */
protected Composite createToolTipContentArea(Event event, Composite parent) {
	Image image = getImage(event);
	Image bgImage = getBackgroundImage(event);
	String text = getText(event);
	Color fgColor = getForegroundColor(event);
	Color bgColor = getBackgroundColor(event);
	Font font = getFont(event);

	CLabel label = new CLabel(parent, getStyle(event));
	if (text != null) {
		label.setText(text);
	}

	if (image != null) {
		label.setImage(image);
	}

	if (fgColor != null) {
		label.setForeground(fgColor);
	}

	if (bgColor != null) {
		label.setBackground(bgColor);
	}

	if (bgImage != null) {
		label.setBackgroundImage(image);
	}

	if (font != null) {
		label.setFont(font);
	}

	return label;
}
 
開發者ID:ghillairet,項目名稱:gef-gwt,代碼行數:56,代碼來源:DefaultToolTip.java

示例6: createUI_10_UpperPart

import org.eclipse.swt.custom.CLabel; //導入方法依賴的package包/類
private void createUI_10_UpperPart(final Composite parent) {

		final Composite container = new Composite(parent, SWT.NONE);
		GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(container);
		container.setForeground(_fgColor);
		container.setBackground(_bgColor);
		GridLayoutFactory
				.fillDefaults()//
				.numColumns(3)
				.applyTo(container);
//		container.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
		{
			/*
			 * tour type
			 */
			if (_uiTourTypeName != null) {

				_lblTourType = new CLabel(container, SWT.NONE);
				GridDataFactory
						.swtDefaults()//
						.align(SWT.BEGINNING, SWT.BEGINNING)
						.applyTo(_lblTourType);
				_lblTourType.setForeground(_fgColor);
				_lblTourType.setBackground(_bgColor);
			}

			/*
			 * title
			 */
			_lblTitle = new Label(container, SWT.LEAD | SWT.WRAP);
			GridDataFactory
					.fillDefaults()//
					.hint(MAX_DATA_WIDTH, SWT.DEFAULT)
					.grab(true, false)
					.align(SWT.FILL, SWT.CENTER)
					.applyTo(_lblTitle);
			_lblTitle.setForeground(_fgColor);
			_lblTitle.setBackground(_bgColor);
			MTFont.setBannerFont(_lblTitle);

			/*
			 * action toolbar in the top right corner
			 */
			createUI_12_Toolbar(container);

			/*
			 * date
			 */
			_lblDate = createUI_LabelValue(container, SWT.LEAD);
			GridDataFactory.fillDefaults().span(3, 1).applyTo(_lblDate);
		}
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:53,代碼來源:TourInfoUI.java

示例7: createUI_44_Weather

import org.eclipse.swt.custom.CLabel; //導入方法依賴的package包/類
private void createUI_44_Weather(final Composite parent) {

		Label label;

		/*
		 * clouds
		 */
		label = createUI_Label(parent, Messages.Tour_Tooltip_Label_Clouds);
		_firstColumnControls.add(label);

		// icon: clouds
		_lblClouds = new CLabel(parent, SWT.TRAIL);
		GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(_lblClouds);
		_lblClouds.setForeground(_fgColor);
		_lblClouds.setBackground(_bgColor);

		// text: clouds
		_lblCloudsUnit = createUI_LabelValue(parent, SWT.LEAD);
		GridDataFactory.swtDefaults().applyTo(_lblCloudsUnit);

		/*
		 * temperature
		 */
		label = createUI_Label(parent, Messages.Tour_Tooltip_Label_Temperature);
		_firstColumnControls.add(label);

		_lblTemperature = createUI_LabelValue(parent, SWT.TRAIL);
		_secondColumnControls.add(_lblTemperature);

		createUI_Label(parent, UI.UNIT_LABEL_TEMPERATURE);

		/*
		 * wind speed
		 */
		label = createUI_Label(parent, Messages.Tour_Tooltip_Label_WindSpeed);
		_firstColumnControls.add(label);

		_lblWindSpeed = createUI_LabelValue(parent, SWT.TRAIL);
		_secondColumnControls.add(_lblWindSpeed);

		_lblWindSpeedUnit = createUI_LabelValue(parent, SWT.LEAD);

		/*
		 * wind direction
		 */
		label = createUI_Label(parent, Messages.Tour_Tooltip_Label_WindDirection);
		_firstColumnControls.add(label);

		_lblWindDirection = createUI_LabelValue(parent, SWT.TRAIL);
		_secondColumnControls.add(_lblWindDirection);

		_lblWindDirectionUnit = createUI_LabelValue(parent, SWT.LEAD);
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:54,代碼來源:TourInfoUI.java


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