Java Code Examples for org.eclipse.swt.widgets.Label.setBackground()

The following are Jave code examples for showing how to use setBackground() of the org.eclipse.swt.widgets.Label class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ide-plugins   File: PluginsSWT.java   View Source Code Vote up 6 votes
@Override
protected Composite createViewerToolTipContentArea(Event event, ViewerCell cell, Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    composite.setBackground(rowColorBack);
    Plugin plugin = (Plugin) cell.getElement();

    Hyperlink button = new Hyperlink(composite, SWT.FLAT);
    button.setText("\uf05A");
    button.setFont(fontAwesome);
    button.setBackground(composite.getBackground());
    button.setForeground(rowColorTitle);
    button.setUnderlined(false);
    button.addListener (SWT.MouseDown, e -> Program.launch(GLUON_PLUGIN_URL + plugin.getUrl()));
    button.setToolTipText("Click to access the service's JavaDoc");

    Label text = new Label(composite, SWT.LEFT);
    final String description = plugin.getDescription();
    text.setText(description.contains(".") ? description.substring(0, description.indexOf(".")) : description);
    text.setBackground(composite.getBackground());
    text.setForeground(rowColorTitle);
    composite.pack();
    return composite;
}
 
Example 2
Project: ide-plugins   File: PluginDialog.java   View Source Code Vote up 6 votes
protected void createTopContent(String title, InputStream imageName) {
    Composite top = new Composite(composite, SWT.NONE);

    top.setLayout(new GridLayout(2, false));
    top.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    top.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
    
    final Image image = new Image(top.getDisplay(), imageName);
    Image resized = resizeImage(image, 48, 48);
    Label labelImage = new Label(top, SWT.CENTER);
    labelImage.setImage(resized);
    
    Label label = new Label(top, SWT.NONE);
    label.setText(title);
    final Font newFont = new Font(display, fontName, getTitleFontSize(), SWT.NORMAL);
    label.setFont(newFont);
    label.setBackground(rowColorSelection);
    
    createLineContent();
    
    top.addDisposeListener(e -> {
        newFont.dispose();
        resized.dispose();
    });
}
 
Example 3
Project: eZooKeeper   File: InfoBar.java   View Source Code Vote up 6 votes
/**
 * Constructor.
 * 
 * @param parent The parent {@link Composite}.
 * @param style The InfoBar {@link Composite#getStyle() style}.
 */
public InfoBar(Composite parent, int style) {
    super(parent, style);
    setVisible(false);

    FormLayout layout = new FormLayout();
    layout.marginTop = 5;
    layout.marginBottom = 5;
    layout.marginLeft = 5;
    layout.marginRight = 5;
    layout.spacing = 5;
    setLayout(layout);

    Color backgroundColor = parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);

    setBackground(backgroundColor);
    _Label = new Label(this, SWT.LEAD | SWT.WRAP);
    _Label.setBackground(backgroundColor);

    FormData labelFormData = new FormData();
    labelFormData.top = new FormAttachment(0, 0);
    labelFormData.left = new FormAttachment(0, 0);
    _Label.setLayoutData(labelFormData);
}
 
Example 4
Project: convertigo-eclipse   File: ConnectorEditorPart.java   View Source Code Vote up 6 votes
/**
 * This method initializes composite
 * 
 */
private void createComposite() {
	GridData gridData7 = new org.eclipse.swt.layout.GridData();
	gridData7.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
	gridData7.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
	GridData gridData4 = new org.eclipse.swt.layout.GridData();
	gridData4.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
	gridData4.grabExcessHorizontalSpace = false;
	gridData4.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
	GridLayout gridLayout4 = new GridLayout();
	gridLayout4.numColumns = 2;
	compositeOutputFooter = new Composite(compositeOutput, SWT.NONE);
	compositeOutputFooter.setBackground(new Color(Display.getCurrent(), 162, 194, 250));
	compositeOutputFooter.setLayout(gridLayout4);
	compositeOutputFooter.setLayoutData(gridData4);
	label1 = new Label(compositeOutputFooter, SWT.NONE);
	label1.setBackground(new Color(Display.getCurrent(), 162, 194, 250));
	label1.setText("Last detected screen class:");
	label1.setToolTipText("Displays the current screen class name");

	labelLastDetectedScreenClass = new Label(compositeOutputFooter, SWT.NONE);
	labelLastDetectedScreenClass.setBackground(new Color(Display.getCurrent(), 162, 194, 250));
	labelLastDetectedScreenClass.setText("(unknown)");
	labelLastDetectedScreenClass.setLayoutData(gridData7);
	labelLastDetectedScreenClass.setToolTipText("Displays the current screen class name");
}
 
Example 5
Project: Hydrograph   File: ComponentTooltip.java   View Source Code Vote up 6 votes
private void addLookupConfigurationDetailsInTooltip(final Composite container, String driverKey, String lookupKey, String lookupPort)
{
	Label driverKeyLabel = new Label(container, SWT.NONE);
	Label lookupKeyLabel = new Label(container, SWT.NONE);
	Label lookupPortLabel = new Label(container, SWT.NONE);
	driverKeyLabel.setText(DRIVER_KEY+driverKey);
	lookupKeyLabel.setText(LOOKUP_KEY+lookupKey);
	lookupPortLabel.setText(LOOKUP_PORT+lookupPort);
	driverKeyLabel.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
	driverKeyLabel.addListener(SWT.MouseUp, getMouseClickListener(container));
	lookupKeyLabel.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
	lookupKeyLabel.addListener(SWT.MouseUp, getMouseClickListener(container));
	lookupPortLabel.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
	lookupPortLabel.addListener(SWT.MouseUp, getMouseClickListener(container));
	showErrorMessageWhenFieldIsEmpty(driverKey,driverKeyLabel,Messages.DRIVER_KEY_ERROR_MESSAGE);
	showErrorMessageWhenFieldIsEmpty(lookupKey,lookupKeyLabel,Messages.LOOKUP_KEY_ERROR_MESSAGE);
}
 
Example 6
Project: scanning   File: AxesCellEditor.java   View Source Code Vote up 5 votes
private CCombo createLabelledCombo(Composite content, String slabel) {

		Label label = new Label(content, SWT.NONE);
		label.setBackground(content.getDisplay().getSystemColor(SWT.COLOR_WHITE));
		label.setText("    "+slabel+" ");
		label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true));

		CCombo ret = new CCombo(content, SWT.READ_ONLY|SWT.BORDER);
		ret.setItems(getNames());
		GridData fill = new GridData(SWT.FILL, SWT.CENTER, true, true);
		fill.widthHint=100;
		ret.setLayoutData(fill);

		return ret;
	}
 
Example 7
Project: Hydrograph   File: PaletteToolTip.java   View Source Code Vote up 5 votes
/**
 * Add tooltip text area - toolTipText(Label hydrograph.ui.tooltip.tooltips.PaletteToolTip.toolTipText)
 */
private void addToolTipTextArea() {
	toolTipText = new Label(toolTipComposite, SWT.NONE);
	toolTipComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
	toolTipText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	toolTipComposite.setSize(toolTipComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));		
	toolTipText.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
	
	logger.debug("Initialized Tooltip text area");
}
 
Example 8
Project: Hydrograph   File: ComponentTooltip.java   View Source Code Vote up 5 votes
private Label setExternalSchemaInTooltip(final Composite container, String externalSchemaPath) {
	Label externalSchemaPathLabel = new Label(container, SWT.NONE);
	externalSchemaPathLabel.setText(EXTERNAL_SCHEMA_PATH + externalSchemaPath);
	externalSchemaPathLabel.setBackground(container.getDisplay().getSystemColor(
			SWT.COLOR_INFO_BACKGROUND));
	externalSchemaPathLabel.addListener(SWT.MouseUp, getMouseClickListener(container));
	return externalSchemaPathLabel;
}
 
Example 9
Project: Hydrograph   File: ComponentTooltip.java   View Source Code Vote up 5 votes
private void addJoinKeysInTooltip(final Composite container, String joinKey, int index)
{
	Label joinKeyLabel = new Label(container, SWT.NONE);
	joinKeyLabel.setText(JOIN_KEY+index+":"+joinKey);
	joinKeyLabel.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
	joinKeyLabel.addListener(SWT.MouseUp, getMouseClickListener(container));
	showErrorMessageWhenFieldIsEmpty(joinKey,joinKeyLabel,Messages.JOIN_KEY_ERROR_MESSAGE);
}
 
Example 10
Project: Hydrograph   File: ComponentTooltip.java   View Source Code Vote up 5 votes
private void addRecordRequiredInTooltip(final Composite container, String recordRequired, int index)
{
	Label recordRequiredLabel = new Label(container, SWT.NONE);
	recordRequiredLabel.setText(RECORD_REQUIRED+index+":"+recordRequired);
	recordRequiredLabel.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
	recordRequiredLabel.addListener(SWT.MouseUp, getMouseClickListener(container));
}
 
Example 11
Project: Hydrograph   File: ComponentTooltip.java   View Source Code Vote up 5 votes
private Label addPropertyInTooltipWindow(final Composite container, PropertyToolTipInformation propertyInfo) {
	Label lblTextProperty = new Label(container, SWT.NONE);
	String propertyNameCapitalized = getCapitalizedName(propertyInfo);

	logger.debug("ComponentTooltip.addPropertyToToolTip() - propertyInfo=" + propertyInfo.toString());

	addText(propertyInfo, lblTextProperty, propertyNameCapitalized);

	lblTextProperty.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
	lblTextProperty.addListener(SWT.MouseUp, getMouseClickListener(container));
	return lblTextProperty;
}
 
Example 12
Project: openaudible   File: BookInfoPanel.java   View Source Code Vote up 5 votes
private GridComposite createStatsView(GridComposite parent) {
    GridComposite c = null;
    if (true) {
        c = new GridComposite(parent, SWT.BORDER_DOT);

        c.initLayout(2, false, GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
        c.noMargins();


        c.getGridData().horizontalIndent = 0;
        c.getGridData().verticalIndent = 0;
        // c.debugLayout(SWT.COLOR_BLUE);

    } else {
        c = parent;
    }

    for (BookElement s : elems) {


        String labelName = getName(s);
        Label l = c.newLabel();
        l.setText(Translate.getInstance().labelName(labelName) + ": ");
        l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        l.setFont(FontShop.tableFontBold());
        l.setBackground(bgColor);

        Label d = c.newLabel();
        d.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        d.setFont(FontShop.tableFont());
        d.setBackground(bgColor);
        d.setData(s);
        stats[s.ordinal()] = d;
    }
    return c;
}
 
Example 13
Project: openaudible   File: StatusPanel.java   View Source Code Vote up 5 votes
StatusPanel(Composite c) {
    super(c, SWT.NONE);
    initLayout(2, false, GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);

    BookNotifier.getInstance().addListener(this);
    ConnectionNotifier.getInstance().addListener(this);

    Status elems[] = Status.values();
    stats = new Label[elems.length];


    for (int x = 0; x < elems.length; x++) {
        if (!elems[x].display())
            continue;
        String labelName = elems[x].displayName();
        Label l = newLabel();
        l.setText(Translate.getInstance().labelName(labelName) + ": ");
        l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        l.setFont(FontShop.tableFontBold());
        l.setBackground(bgColor);

        Label d = newLabel();
        GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
        // gd.widthHint=120;
        d.setLayoutData(gd);

        d.setFont(FontShop.tableFont());
        d.setBackground(bgColor);
        d.setData(elems[x]);
        stats[x] = d;
    }

    _update();
}
 
Example 14
Project: openaudible   File: FakeToolTip.java   View Source Code Vote up 5 votes
/**
 * Create the Shell and Label for the fake tooltip showing URLs
 */
private void createFakeToolTip() {
    fakeToolTip = new Shell(GUI.shell, SWT.ON_TOP);
    fakeToolTip.setLayout(LayoutShop.createFillLayout(2, 2));
    fakeToolTip.setForeground(GUI.display
            .getSystemColor(SWT.COLOR_INFO_FOREGROUND));
    fakeToolTip.setBackground(GUI.display
            .getSystemColor(SWT.COLOR_INFO_BACKGROUND));
    fakeToolTipLabel = new Label(fakeToolTip, SWT.NONE);
    fakeToolTipLabel.setForeground(GUI.display
            .getSystemColor(SWT.COLOR_INFO_FOREGROUND));
    fakeToolTipLabel.setBackground(GUI.display
            .getSystemColor(SWT.COLOR_INFO_BACKGROUND));
}
 
Example 15
Project: avoCADo   File: XYZDisplayComp.java   View Source Code Vote up 4 votes
public XYZDisplayComp(Composite parent, int style){
	super(parent, style);
	
	this.setLayout(new RowLayout(SWT.HORIZONTAL));
	this.setBackground(AvoColors.COLOR_QSET_BG);
	
	FontData fd = new FontData();
	fd.setHeight(10);
	fd.setStyle(SWT.BOLD);
	fd.setName("Verdana");
	Font f = new Font(this.getDisplay(), fd);		
	
	Label llx = new Label(this, SWT.NO_BACKGROUND);
	llx.setFont(f);
	llx.setText("X:");
	llx.setBackground(AvoColors.COLOR_QSET_BG);
	lX = new Label(this, SWT.NONE);	
	lX.setAlignment(SWT.RIGHT);
	lX.setFont(f);
	lX.setBackground(AvoColors.COLOR_QSET_BG);
	
	Label lly = new Label(this, SWT.NONE);
	lly.setFont(f);
	lly.setText(" Y:");
	lly.setBackground(AvoColors.COLOR_QSET_BG);
	lY = new Label(this, SWT.NONE);
	lY.setAlignment(SWT.RIGHT);
	lY.setFont(f);
	lY.setBackground(AvoColors.COLOR_QSET_BG);
	
	Label llz = new Label(this, SWT.NONE);
	llz.setFont(f);
	llz.setText(" Z:");
	llz.setBackground(AvoColors.COLOR_QSET_BG);
	lZ = new Label(this, SWT.NONE);
	lZ.setAlignment(SWT.RIGHT);
	lZ.setFont(f);
	lZ.setBackground(AvoColors.COLOR_QSET_BG);
	
	updateXYZ();
	
	AvoGlobal.glViewEventHandler.addGLViewListener(new GLViewListener(){
		@Override
		public void cursorMoved() {
			updateXYZ();
		}			
	});
}
 
Example 16
Project: vertigo-chroma-kspplugin   File: AboutDialog.java   View Source Code Vote up 4 votes
@Override
protected Control createDialogArea(Composite parent) {
	/* Titre dialogue. */
	this.getShell().setText("About KSP Plugin");

	/* Layout */
	Composite container = (Composite) super.createDialogArea(parent);
	GridLayout layout = new GridLayout(1, false);
	layout.marginRight = 5;
	layout.marginLeft = 10;
	Color white = Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);
	container.setBackground(white);
	container.setLayout(layout);

	/* Logo */
	Label lblLogo = new Label(container, SWT.NONE);
	lblLogo.setBackgroundImage(getImage());
	lblLogo.setBackground(white);
	lblLogo.setText("      ");
	lblLogo.setSize(LOGO_SIZE, LOGO_SIZE);

	/* Produit */
	Label lblProduct = new Label(container, SWT.NONE);
	lblProduct.setText("Vertigo Chroma KSP Plugin");
	lblProduct.setBackground(white);

	/* Version */
	Version version = FrameworkUtil.getBundle(getClass()).getVersion();
	String fullVersion = version.toString();
	Label lblVersion = new Label(container, SWT.NONE);
	lblVersion.setText("Version : " + fullVersion);
	lblVersion.setBackground(white);

	/* Version */
	Label lblAuthor = new Label(container, SWT.NONE);
	lblAuthor.setText("Author : @sebez");
	lblAuthor.setBackground(white);

	/* Libellé documentation */
	Label lblDoc = new Label(container, SWT.NONE);
	lblDoc.setText("Documentation, sources, releases are published in the KSP plugin github repository : ");
	lblDoc.setBackground(white);

	/* Lien vers le github */
	Link link = new Link(container, SWT.NONE);
	String message = "<a href=\"" + GITHUB_URL + "\">" + GITHUB_URL + "</a>";
	link.setText(message);
	link.setBackground(white);
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			Program.launch(GITHUB_URL);
		}
	});

	return container;
}