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


Java CLabel.setFont方法代码示例

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


在下文中一共展示了CLabel.setFont方法的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: 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

示例3: initControl

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
@Override
	protected void initControl() {
		label = new CLabel(parent, controlStyle);
//		label = new Label(parent, controlStyle);

		FontData[] fD = label.getFont().getFontData();
		fD[0].setHeight(DEFAULT_FONT_SIZE);
//		label.setFont(new Font(display,fD[0]));
		label.setFont(Fonts.createFont(fD[0]));
		
		this.setControl(label);
	}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:13,代码来源:LabelToolItem.java

示例4: DetailsContentViewer

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
/**
 * Constructs a new instance of this class given its parent and a style
 * value describing its behavior and appearance.
 *
 * @param parent
 *            the parent component
 * @param style
 *            SWT style bits
 */
public DetailsContentViewer(Composite parent, int style) {
	viewForm = new ViewForm(parent, style);
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	gd.horizontalSpan = 2;
	viewForm.setLayoutData(gd);
	label = new CLabel(viewForm, SWT.FLAT);
	label.setFont(parent.getFont());
	viewForm.setContent(label);
	hookControl(label);
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:20,代码来源:FilteredItemsSelectionDialog.java

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

示例6: createTitleArea

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
/**
 * Creates the title area of the right side of the dialog.
 * 
 * @param parent the title area container
 * @return the composite representing the title area
 */
protected Composite createTitleArea(Composite parent) {
	Composite titleArea = new Composite(parent, SWT.NONE);
	GridData gd_TitleArea=new GridData(SWT.FILL,SWT.FILL,true,false,1,1);
	titleArea.setLayoutData(gd_TitleArea);
	FillLayout fl_TitleArea = new FillLayout(SWT.VERTICAL);
	fl_TitleArea.marginHeight=5;
	fl_TitleArea.marginWidth=5;
	titleArea.setLayout(fl_TitleArea);
   titleLabel = new CLabel(titleArea, SWT.NONE);
   titleLabel.setFont(JFaceResources.getBannerFont());
	return titleArea;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:19,代码来源:TreePropertiesViewerPanel.java

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

示例8: createSectionTitle

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
/**
 * A convenient method to create CLabel titles (like the ones used in the
 * Preferences dialog in the Eclipse workbench) throughout the dialog.
 * 
 * @param composite
 *            The composite in which the title is to be created (it must
 *            have a GridLayout with two columns).
 * @param text
 *            The title to be displayed
 * @return The newly created CLabel for convenience
 */
protected CLabel createSectionTitle(Composite composite, String text) {
	CLabel cTitle = new CLabel(composite, SWT.LEFT);
	Color background = JFaceColors.getBannerBackground(composite
			.getDisplay());
	Color foreground = JFaceColors.getBannerForeground(composite
			.getDisplay());
	JFaceColors.setColors(cTitle, foreground, background);
	cTitle.setFont(JFaceResources.getBannerFont());
	cTitle.setText(text);
	cTitle.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
			| GridData.VERTICAL_ALIGN_FILL));

	if (titleImage == null) {
		titleImage = new Image(composite.getDisplay(), ImageDescriptor
				.createFromFile(Internal.class,
						"icons/customizer_dialog_title.gif").getImageData()); //$NON-NLS-1$
		composite.addDisposeListener(new DisposeListener() {
			public void widgetDisposed(DisposeEvent e) {
				titleImage.dispose();
				titleImage = null;
			}
		});
	}

	Label imageLabel = new Label(composite, SWT.LEFT);
	imageLabel.setBackground(background);
	imageLabel.setImage(titleImage);
	imageLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
			| GridData.VERTICAL_ALIGN_FILL));

	Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
	GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
	data.horizontalSpan = 2;
	separator.setLayoutData(data);

	return cTitle;
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:49,代码来源:PaletteCustomizerDialog.java

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

示例10: createContents

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
/**
 * Create the contents for the receiver.
 * 
 * @param parent
 *            the Composite that the children will be created in
 */
public void createContents(Composite parent) {
   
    // Message label
    titleLabel = new CLabel(parent, SWT.NONE);
    titleLabel.setFont(JFaceResources.getBannerFont());
    messageComposite = new Composite(parent, SWT.NONE);
    GridLayout messageLayout = new GridLayout();
    messageLayout.numColumns = 2;
    messageLayout.marginWidth = 0;
    messageLayout.marginHeight = 0;
    messageLayout.makeColumnsEqualWidth = false;
    messageComposite.setLayout(messageLayout);
    messageImageLabel = new Label(messageComposite, SWT.NONE);
    messageImageLabel.setImage(JFaceResources
            .getImage(Dialog.DLG_IMG_MESSAGE_INFO));
    messageImageLabel.setLayoutData(new GridData(
            GridData.VERTICAL_ALIGN_CENTER));
  
    messageText = new Text(messageComposite, SWT.NONE);
    messageText.setEditable(false);
  
    GridData textData = new GridData(GridData.GRAB_HORIZONTAL
            | GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
    messageText.setLayoutData(textData);
  
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:33,代码来源:DialogMessageArea.java

示例11: createCLabel

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
static public CLabel createCLabel(Composite parent, String label, int hSpan) {
    CLabel pgTitle = new CLabel(parent, SWT.NONE);
    pgTitle.setText(label); 
    pgTitle.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    pgTitle.setFont(JFaceResources.getHeaderFont());
    GridData titleGridData = new GridData();
    titleGridData.grabExcessHorizontalSpace = true;
    titleGridData.horizontalSpan = hSpan;
    pgTitle.setLayoutData(titleGridData);
    return pgTitle;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:12,代码来源:XSPEditorUtil.java

示例12: createGroup

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
/**
 * This method initializes group
 * 
 */
private void createGroup() {
    group = new Group(shell, SWT.NONE);
    group.setText(Messages.getString("IndicatorGroupDialog.indicator")); //$NON-NLS-1$
    group.setBounds(new org.eclipse.swt.graphics.Rectangle(3, 2, 419, 75));
    lblName = new CLabel(group, SWT.NONE);
    lblName.setText(Messages.getString("IndicatorGroupDialog.name")); //$NON-NLS-1$
    lblName.setFont(new Font(Display.getDefault(), "Tahoma", 8, SWT.BOLD)); //$NON-NLS-1$
    lblName.setBounds(new Rectangle(8, 15, 44, 22));
    lblId = new CLabel(group, SWT.NONE);
    lblId.setText(Messages.getString("IndicatorGroupDialog.id")); //$NON-NLS-1$
    lblId.setFont(new Font(Display.getDefault(), "Tahoma", 8, SWT.BOLD)); //$NON-NLS-1$
    lblId.setBounds(new Rectangle(263, 17, 37, 19));
    lblDescription = new CLabel(group, SWT.NONE);
    lblDescription.setFont(new Font(Display.getDefault(), "Tahoma", 8, SWT.BOLD)); //$NON-NLS-1$
    lblDescription.setLocation(new org.eclipse.swt.graphics.Point(8, 41));
    lblDescription.setText(Messages.getString("IndicatorGroupDialog.description")); //$NON-NLS-1$
    lblDescription.setSize(new org.eclipse.swt.graphics.Point(80, 22));
    cLabelGrlName = new CLabel(group, SWT.SHADOW_IN);
    cLabelGrlName.setText(""); //$NON-NLS-1$
    cLabelGrlName.setLocation(new Point(56, 15));
    cLabelGrlName.setSize(new Point(199, 23));
    cLabelGrlDescription = new CLabel(group, SWT.SHADOW_IN);
    cLabelGrlDescription.setText(""); //$NON-NLS-1$
    cLabelGrlDescription.setLocation(new Point(95, 41));
    cLabelGrlDescription.setSize(new org.eclipse.swt.graphics.Point(315, 23));
    cLabelGrlId = new CLabel(group, SWT.SHADOW_IN);
    cLabelGrlId.setText(""); //$NON-NLS-1$
    cLabelGrlId.setLocation(new Point(306, 15));
    cLabelGrlId.setSize(new org.eclipse.swt.graphics.Point(103, 23));
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:35,代码来源:IndicatorGroupDialog.java

示例13: 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>
 */
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:de-jcup,项目名称:egradle,代码行数:32,代码来源:SWTFactory.java

示例14: ContextComponent

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
/**
 * Default constructor.
 * 
 * @param parent
 *            parent
 * @param conflict
 *            conflict
 */
public ContextComponent(DecisionBox parent, VisualConflict conflict) {
	super(parent, SWT.NONE);

	ConflictContext context = conflict.getConflictContext();

	GridLayout layout = new GridLayout(3, false);
	layout.verticalSpacing = 1;
	layout.horizontalSpacing = 20;
	this.setLayout(layout);
	this.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

	setBackground(parent.getBackground());

	FontRegistry fontRegistry = UIDecisionUtil.getFontRegistry();

	Label meTitle = new Label(this, SWT.NONE);
	meTitle.setText(context.getModelElementTitleLabel());
	meTitle.setFont(fontRegistry.get("titleLabel"));
	meTitle.setBackground(getBackground());

	Label attTitle = new Label(this, SWT.NONE);
	attTitle.setText(context.getAttributeTitleLabel());
	attTitle.setFont(fontRegistry.get("titleLabel"));
	attTitle.setBackground(getBackground());

	Label oppTitle = new Label(this, SWT.NONE);
	oppTitle.setText(context.getOpponentTitleLabel());
	oppTitle.setFont(fontRegistry.get("titleLabel"));
	oppTitle.setBackground(getBackground());

	adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
	AdapterFactoryLabelProvider provider = new AdapterFactoryLabelProvider(adapterFactory);

	CLabel meLabel = new CLabel(this, SWT.NONE);
	meLabel.setImage(provider.getImage(context.getModelElement()));
	meLabel.setText(UIDecisionUtil.cutString(provider.getText(context.getModelElement()), 40, true));
	meLabel.setToolTipText(DecisionUtil.getClassAndName(context.getModelElement()));
	meLabel.setFont(fontRegistry.get("content"));
	meLabel.setBackground(getBackground());

	Label attLabel = new Label(this, SWT.NONE);
	attLabel.setText(context.getAttribute());
	attLabel.setFont(fontRegistry.get("content"));
	attLabel.setBackground(getBackground());

	Label oppLable = new Label(this, SWT.NONE);
	oppLable.setText(context.getOpponent());
	oppLable.setFont(fontRegistry.get("content"));
	oppLable.setBackground(getBackground());
}
 
开发者ID:edgarmueller,项目名称:emfstore-rest,代码行数:59,代码来源:ContextComponent.java

示例15: createLabel

import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
private CLabel createLabel() {
	CLabel label = new CLabel( this, SWT.NONE);
  label.setFont( lookAndBehaviour.getMessageFont( getErrorKind()));//new Font( Display.getCurrent(), fontData[0]));
	label.setImage( lookAndBehaviour.getMessageImage( getErrorKind()));
	return label;
}
 
开发者ID:SpirentTechnologies,项目名称:PlayCustomParameters,代码行数:7,代码来源:MessageLabel.java


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