当前位置: 首页>>代码示例>>Java>>正文


Java CLabel.setImage方法代码示例

本文整理汇总了Java中org.eclipse.swt.custom.CLabel.setImage方法的典型用法代码示例。如果您正苦于以下问题:Java CLabel.setImage方法的具体用法?Java CLabel.setImage怎么用?Java CLabel.setImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.custom.CLabel的用法示例。


在下文中一共展示了CLabel.setImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addStats

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
private void addStats() {

		for (String key : statsProject.keySet()) {
			if (key != project.getName()) {
				CLabel title = new CLabel(descriptifRight, SWT.BOLD);
				title.setText(key);
				title.setImage(new Image(display, getClass()
						.getResourceAsStream(
								"images/stats_"
										+ key.replaceAll(" ", "_")
												.toLowerCase() + "_16x16.png")));
				title.setBackground(new Color(display, 255, 255, 255));
				title.setMargins(10, 10, 0, 0);

				FontData[] fd = title.getFont().getFontData();
				fd[0].setStyle(SWT.BOLD);
				title.setFont(new Font(title.getFont().getDevice(), fd));

				CLabel subText = new CLabel(descriptifRight, SWT.NONE);
				subText.setText(statsProject.get(key)
						.replaceAll("<br/>", "\r\n").replaceAll("&nbsp;", " "));
				subText.setBackground(new Color(display, 255, 255, 255));
				subText.setMargins(30, 0, 0, 0);
			}
		}
	}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:27,代码来源:StatisticsDialog.java

示例2: createUI_26_SmoothAltitude

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
private void createUI_26_SmoothAltitude(final Composite parent) {

		/*
		 * image: altitude
		 */
		_iconAltitude = new CLabel(parent, SWT.NONE);
		GridDataFactory.fillDefaults().indent(16, 0).applyTo(_iconAltitude);
		_iconAltitude.setBackground(_tk.getColors().getBackground());
		_iconAltitude.setImage(_imageAltitude);

		/*
		 * checkbox: smooth altitude
		 */
		_chkIsAltitudeSmoothing = _tk.createButton(
				parent,
				Messages.TourChart_Smoothing_Checkbox_IsAltitudeSmoothing,
				SWT.CHECK);
		GridDataFactory.fillDefaults() //
				.align(SWT.FILL, SWT.CENTER)
				.span(2, 1)
				.applyTo(_chkIsAltitudeSmoothing);
		_chkIsAltitudeSmoothing.setToolTipText(Messages.TourChart_Smoothing_Checkbox_IsAltitudeSmoothing_Tooltip);
		_chkIsAltitudeSmoothing.addSelectionListener(_selectionListener);
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:25,代码来源:SmoothingUI_Jamet.java

示例3: updateUI_TourType

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
/**
 * Sets the tour type image and text into a {@link CLabel}
 * 
 * @param tourData
 * @param lblTourType
 * @param isTextDisplayed
 */
public static void updateUI_TourType(	final TourData tourData,
										final CLabel lblTourType,
										final boolean isTextDisplayed) {

	final TourType tourType = tourData.getTourType();

	// tour type
	if (tourType == null) {
		lblTourType.setText(UI.EMPTY_STRING);
		lblTourType.setImage(TourTypeImage.getTourTypeImage(TourDatabase.ENTITY_IS_NOT_SAVED));
	} else {
		lblTourType.setImage(TourTypeImage.getTourTypeImage(tourType.getTypeId()));
		lblTourType.setText(isTextDisplayed ? tourType.getName() : UI.EMPTY_STRING);
	}

	lblTourType.pack(true);
	lblTourType.redraw(); // display changed tour image
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:26,代码来源:UI.java

示例4: 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

示例5: createWrapCLabel

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
/**
 * Creates a new <code>CLabel</code> that will wrap at the specified width and has the specified image
 * @param parent the parent to add this label to
 * @param text the text for the label
 * @param image the image for the label
 * @param hspan the h span to take up in the parent
 * @param wrapwidth the with to wrap at
 * @return a new <code>CLabel</code>
 * @since 3.3
 */
public static CLabel createWrapCLabel(Composite parent, String text, Image image, int hspan, int wrapwidth) {
	CLabel label = new CLabel(parent, SWT.NONE | SWT.WRAP);
	label.setFont(parent.getFont());
	if(text != null) {
		label.setText(text);
	}
	if(image != null) {
		label.setImage(image);
	}
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	gd.horizontalSpan = hspan;
	gd.widthHint = wrapwidth;
	label.setLayoutData(gd);
	return label;
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:26,代码来源:SWTFactory.java

示例6: element

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
private void element(String text, Object model, int colorIndex) {
	if (model instanceof CategorizedDescriptor || model instanceof CategorizedEntity) {
		ImageHyperlink link = new ImageHyperlink(composite, SWT.TOP);
		link.setText(text);
		link.setImage(getImage(colorIndex));
		Controls.onClick(link, (e) -> {
			if (model instanceof CategorizedDescriptor) {
				App.openEditor((CategorizedDescriptor) model);
			} else if (model instanceof CategorizedEntity) {
				App.openEditor((CategorizedEntity) model);
			}
		});
		createdLinks.push(link);
	} else {
		CLabel label = new CLabel(composite, SWT.TOP);
		label.setImage(getImage(colorIndex));
		label.setText(text);
		createdLinks.push(label);
	}
}
 
开发者ID:GreenDelta,项目名称:olca-app,代码行数:21,代码来源:ChartLegend.java

示例7: initNotificationsPrefsTab

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
private void initNotificationsPrefsTab() {
    TabItem notificationsTabbedItem = new TabItem(tabFolder, SWT.NONE);
    notificationsTabbedItem.setText("Notifications");

    notificationsComposite = new Composite(tabFolder, SWT.NONE);
    notificationsTabbedItem.setControl(notificationsComposite);
    notificationsComposite.setLayout(new GridLayout(1, false));

    this.addEnableNotificationsEditor();
    this.addNotificationsEditors();

    this.addSelectionButtons();

    CLabel explanationsLabel = new CLabel(notificationsComposite, SWT.NONE);
    ImageRegistry reg = WaqtSalatPreferencePlugin.getDefault().getImageRegistry();
    explanationsLabel.setImage(reg.get(WaqtSalatPreferenceConstants.IconsKeys.NOTIFICATION_1));
    explanationsLabel
            .setText("Notifications will alert you when it is time to pray.\nNotification will fade automatically. A small window will be shown at the corner of the screen.");
}
 
开发者ID:paissad,项目名称:waqtsalat-eclipse-plugin,代码行数:20,代码来源:AlertsPrefsPage.java

示例8: createPositionButton

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
private Composite createPositionButton(final Composite content, final String propName, String label, String iconPath) {

		final CLabel position = new CLabel(content, SWT.LEFT);
		position.setBackground(content.getDisplay().getSystemColor(SWT.COLOR_WHITE));
		position.setImage(Activator.getImageDescriptor(iconPath).createImage());
		position.setText(label);
		position.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
		GridUtils.setVisible(position, store.getBoolean(propName));

		return position;
	}
 
开发者ID:eclipse,项目名称:scanning,代码行数:12,代码来源:ScanView.java

示例9: createDialogArea

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {

	// create a composite with standard margins and spacing
	Composite composite = (Composite)super.createDialogArea(parent);
	composite.setLayout(new GridLayout(1, false));

	final CLabel warning = new CLabel(composite, SWT.LEFT);
	warning.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	warning.setImage(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/error.png").createImage());
	warning.setText("Expert queue configuration parameters, please use with caution.");

	TableViewer viewer   = new TableViewer(composite, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
	viewer.setUseHashlookup(true);
	viewer.getTable().setHeaderVisible(true);
	viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	createColumns(viewer);
	viewer.setContentProvider(createContentProvider());

	viewer.setInput(props);

	final Button adv = new Button(composite, SWT.PUSH);
	adv.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
	adv.setText("Advanced...");

	adv.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(getShell(), "org.dawnsci.commandserver.ui.activemqPage", null, null);
			if (pref != null) pref.open();
		}
	});

	return composite;
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:37,代码来源:PropertiesDialog.java

示例10: createContents

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
@Override
protected Control createContents(Composite parent) {
    Composite panel = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    panel.setLayout(layout);

    btnForceUnixNewlines = new Button(panel, SWT.CHECK);
    btnForceUnixNewlines.setText(Messages.ProjectProperties_force_unix_newlines);
    btnForceUnixNewlines.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1));
    btnForceUnixNewlines.setSelection(prefs.getBoolean(PROJ_PREF.FORCE_UNIX_NEWLINES, true));

    Label label = new Label(panel, SWT.NONE);
    label.setText(Messages.projectProperties_timezone_for_all_db_connections);

    cmbTimezone = new Combo(panel, SWT.BORDER | SWT.DROP_DOWN);
    cmbTimezone.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    cmbTimezone.setItems(UIConsts.TIME_ZONES.toArray(new String[UIConsts.TIME_ZONES.size()]));
    String tz = prefs.get(PROJ_PREF.TIMEZONE, ApgdiffConsts.UTC);
    cmbTimezone.setText(tz);
    cmbTimezone.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            checkSwitchWarnLbl();
        }
    });

    lblWarn = new CLabel(panel, SWT.NONE);
    lblWarn.setImage(Activator.getEclipseImage(ISharedImages.IMG_OBJS_WARN_TSK));
    lblWarn.setText(Messages.ProjectProperties_change_projprefs_warn);
    GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, false, false, 2, 1);
    gd.exclude = true;
    lblWarn.setLayoutData(gd);
    lblWarn.setVisible(false);

    return panel;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:40,代码来源:ProjectProperties.java

示例11: createContents

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
protected void createContents() {
	this.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	this.setLayout(new GridLayout());		
	Composite composite = this;

	taskNameLabel = new CLabel(composite, SWT.NONE);
	taskNameLabel.setImage(processImage);
	taskNameLabel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	taskNameLabel.setText(taskName);

	subTaskLabel = new CLabel(composite, SWT.NONE);
	subTaskLabel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	subTaskLabel.setText("");

	progressBarComposite = new Composite(this, SWT.NONE);
	progressBarComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
	progressBarComposite.setLayout(new FillLayout());

	progressBar = new ProgressBar(progressBarComposite, progressBarStyle);
	progressBar.setMaximum(0);
	
	detailLabel = new CLabel(this, SWT.NONE);
	detailLabel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));

	cancelComposite = new Composite(this, SWT.NONE);
	cancelComposite.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
	final GridLayout gridLayout_1 = new GridLayout();
	gridLayout_1.numColumns = 2;
	cancelComposite.setLayout(gridLayout_1);

	cancelButton = new Button(cancelComposite, SWT.NONE);

	cancelButton.setLayoutData(new GridData(78, SWT.DEFAULT));
	cancelButton.setText("Cancel");
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:36,代码来源:ProgressBarComposite.java

示例12: 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

示例13: setLed

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
public void setLed(Serial.Pin led, State state) {
	CLabel lc = getElement(led);
	if (lc == null)
		return;

	lc.setImage(Icons.state(state));
	lc.update();
}
 
开发者ID:ploys,项目名称:ecle,代码行数:9,代码来源:PortStatus.java

示例14: createLed

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
protected CLabel createLed(Composite parent, Serial.Pin led) {
	CLabel element = new CLabel(parent, SWT.NONE);
	element.setTopMargin(1);
	element.setRightMargin(0);
	element.setBottomMargin(1);
	element.setLeftMargin(0);
	element.setText(led.name());
	element.setImage(Icons.state(State.OFF));

	leds.put(led, element);
	return element;
}
 
开发者ID:ploys,项目名称:ecle,代码行数:13,代码来源:PortStatus.java

示例15: createUI_20_SmoothSpeed

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
private void createUI_20_SmoothSpeed(final Composite parent) {

		/*
		 * image: speed
		 */
		_iconSpeed = new CLabel(parent, SWT.NONE);
		GridDataFactory.fillDefaults().indent(16, 0).applyTo(_iconSpeed);
		_iconSpeed.setBackground(_tk.getColors().getBackground());
		_iconSpeed.setImage(_imageSpeed);

		/*
		 * label: smooth speed
		 */
		final Label label = _tk.createLabel(parent, Messages.TourChart_Smoothing_Label_SpeedSmoothing);
		GridDataFactory.fillDefaults() //
				.align(SWT.FILL, SWT.CENTER)
				.applyTo(label);
		label.setToolTipText(Messages.TourChart_Smoothing_Label_SpeedSmoothing_Tooltip);

		/*
		 * spinner: tau
		 */
		_spinnerSpeedTau = new Spinner(parent, SWT.BORDER);
		GridDataFactory.fillDefaults()//
				.align(SWT.BEGINNING, SWT.FILL)
				.applyTo(_spinnerSpeedTau);
		_spinnerSpeedTau.setDigits(1);
		_spinnerSpeedTau.setMinimum(1);
		_spinnerSpeedTau.setMaximum(MAX_TAU);
		_spinnerSpeedTau.addSelectionListener(_selectionListener);
		_spinnerSpeedTau.addMouseWheelListener(_spinnerMouseWheelListener);
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:33,代码来源:SmoothingUI_Jamet.java


注:本文中的org.eclipse.swt.custom.CLabel.setImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。