Java Code Examples for org.eclipse.swt.custom.CLabel#setFont()

The following examples show how to use org.eclipse.swt.custom.CLabel#setFont() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApiDocumentationResultView.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create the composite.
 * 
 * @param parent
 * @param style
 */
public ApiDocumentationResultView() {
	super(SWT.BORDER);
	setBackgroundMode(SWT.INHERIT_FORCE);
	setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	GridLayout gridLayout = new GridLayout(2, false);
	gridLayout.verticalSpacing = 0;
	setLayout(gridLayout);

	lblLabel = new CLabel(this, SWT.NONE);
	lblLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
	lblLabel.setFont(SWTResourceManager.getFont("Segoe UI", 12, SWT.NORMAL));
	lblLabel.setText("<Title of the API documentation>");
	new Label(this, SWT.NONE);

	textUrl = new Text(this, SWT.READ_ONLY | SWT.WRAP);
	textUrl.setEditable(false);
	textUrl.setForeground(SWTResourceManager.getColor(SWT.COLOR_GRAY));
	textUrl.setText("<url>");
	textUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

}
 
Example 2
Source File: CloneDiffWizardPage.java    From JDeodorant with MIT License 6 votes vote down vote up
private void updateRenamedVariables() {
	Control[] children = renamedVariables.getChildren();
	for(Control child : children) {
		child.dispose();
	}
	Set<VariableBindingPair> renamedVariableBindingPairs = mapper.getRenamedVariableBindings();
	if(renamedVariableBindingPairs.size() > 0) {
		for(VariableBindingPair bindingPair : renamedVariableBindingPairs) {
			CLabel renamedVariableLabel = new CLabel(renamedVariables, SWT.NONE);
			String variable1 = bindingPair.getBinding1().getName();
			String variable2 = bindingPair.getBinding2().getName();
			renamedVariableLabel.setText(variable1 + " -> " + variable2);
			renamedVariableLabel.setFont(CONSOLAS_BOLD_FONT);
		}
	}
	renamedVariables.layout();
	renamedVariables.pack();
}
 
Example 3
Source File: SWTFactory.java    From goclipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: FilteredItemsSelectionDialog.java    From tlaplus with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example 5
Source File: DomainStatusLabel.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
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()));
}
 
Example 6
Source File: XSPEditorUtil.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 7
Source File: WidgetMessageDecorator.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public WidgetMessageDecorator(Composite parent, Optional<String> defaultMessage) {
    createComposite(parent);
    this.resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
    errorColor = resourceManager.createColor(ColorConstants.ERROR_RGB);
    warningColor = resourceManager.createColor(ColorConstants.WARNING_RGB);
    this.defaultMessage = defaultMessage;
    messageLabel = new CLabel(composite, SWT.NONE);
    messageLabel.setTopMargin(1);
    messageLabel.setLeftMargin(0);
    messageLabel.setFont(getMessageFont());
    messageLabel.setText(defaultMessage.orElse(""));
    foregroundColor = Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND);
    updateExpandState();
}