Java Code Examples for org.eclipse.swt.widgets.Link#setBackground()
The following examples show how to use
org.eclipse.swt.widgets.Link#setBackground() .
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: DialogAbout.java From arx with Apache License 2.0 | 6 votes |
/** * Creates a link. * * @param parent * @param text * @param tooltip * @param url */ private void createLink(Composite parent, String text, String tooltip, final String url){ Link link = new Link(parent, SWT.NONE); link.setLayoutData(SWTUtil.createFillHorizontallyGridData()); link.setText(text); link.setToolTipText(tooltip); link.setBackground(parent.getBackground()); link.addListener (SWT.Selection, new Listener () { public void handleEvent(Event event) { try { Program.launch(url); } catch (Exception e){ /* Ignore*/ } } }); }
Example 2
Source File: DomainStatusLabel.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected void createLink(DomainStatus status) { link = new Link(this, SWT.NONE); link.setFont(DOMAIN_STATUS_FONT); link.setBackground(ColorConstants.white); link.setText(getMessage(status)); link.setForeground(getSeverityColor(status.getSeverity())); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { status.handleLink(); } }); }
Example 3
Source File: ToolkitControl.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
private void initControl() { GridLayoutFactory.fillDefaults().numColumns(3).spacing(3, 2).applyTo(this); GridLayout layout = (GridLayout) this.getLayout(); layout.marginLeft = 7; layout.marginTop = 2; layout.marginBottom = 2; Label iconLabel = new Label(this, SWT.NULL); iconLabel.setBackground(getBackground()); GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.BEGINNING).span(1, 2).applyTo( iconLabel); listenTo(iconLabel); Link nameLabel = new Link(this, SWT.NONE); nameLabel.setText(wbToolkit.getName()); nameLabel.setBackground(getBackground()); nameLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); nameLabel.setFont(getBoldFont(getFont())); listenTo(nameLabel); Label providerLabel = new Label(this, SWT.NONE); providerLabel.setText(wbToolkit.getProviderDescription()); providerLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); providerLabel.setBackground(getBackground()); providerLabel.setForeground(Display.getDefault().getSystemColor( SWT.COLOR_GRAY)); listenTo(providerLabel); Label summaryLabel = new Label(this, SWT.WRAP); String description = stripCRLF(wbToolkit.getDescription()); summaryLabel.setText(description); summaryLabel.setBackground(getBackground()); GridDataFactory.fillDefaults().grab(true, false).span(2, 1).hint(100, SWT.DEFAULT).applyTo(summaryLabel); listenTo(summaryLabel); listenTo(this); }
Example 4
Source File: AboutDialog.java From devstudio-tooling-ei with Apache License 2.0 | 4 votes |
protected Control createDialogArea(Composite parent) { Image logoImage = ResourceManager.getPluginImage("org.wso2.developerstudio.eclipse.platform.ui", "icons/ei-tooling-logo.png"); logoWidth = logoImage.getImageData().width; logoHeight = logoImage.getImageData().height; parent.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); Composite dialogArea = (Composite) super.createDialogArea(parent); dialogArea.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); dialogArea.setSize(new Point(logoWidth, logoHeight * 4 - 60)); Composite composite = new Composite(dialogArea, SWT.BORDER); composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); composite.setLayout(new GridLayout(1, false)); composite.setSize(new Point(logoWidth + 45, logoHeight * 4 - 60)); GridData gd_composite = new GridData(SWT.CENTER, SWT.TOP, true, true, 1, 1); gd_composite.widthHint = logoWidth + 45; gd_composite.heightHint = logoHeight * 4 - 60; composite.setLayoutData(gd_composite); Label lblDevsLogo = new Label(composite, SWT.NONE); lblDevsLogo.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); lblDevsLogo.setImage(logoImage); GridData gdDevsLogo = new GridData(SWT.CENTER, SWT.TOP, false, false, 1, 1); gdDevsLogo.widthHint = logoWidth; gdDevsLogo.heightHint = logoHeight; lblDevsLogo.setLayoutData(gdDevsLogo); Label lblVersion = new Label(composite, SWT.NONE); GridData versionGrid = new GridData(); versionGrid.horizontalIndent = 25; lblVersion.setLayoutData(versionGrid); lblVersion.setForeground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BORDER)); lblVersion.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); lblVersion.setText(VERSION); Label lblLicense = new Label(composite, SWT.NONE); GridData licenseGrid = new GridData(); licenseGrid.horizontalIndent = 25; lblLicense.setLayoutData(licenseGrid); lblLicense.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); lblLicense.setText(LICENSED); Link linkDevStudioUrl = new Link(composite, SWT.NONE); GridData urlGrid = new GridData(); urlGrid.horizontalIndent = 25; linkDevStudioUrl.setLayoutData(urlGrid); linkDevStudioUrl.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); linkDevStudioUrl.setText("Visit :<a>" + URL + "</a>"); linkDevStudioUrl.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { org.eclipse.swt.program.Program.launch(URL); } }); addProductIcons(composite); return dialogArea; }
Example 5
Source File: AboutDialog.java From developer-studio with Apache License 2.0 | 4 votes |
protected Control createDialogArea(Composite parent) { Image logoImage = ResourceManager.getPluginImage("org.wso2.developerstudio.eclipse.platform.ui", "icons/carbon-studio-logo.png"); logoWidth = logoImage.getImageData().width; logoHeight = logoImage.getImageData().height; parent.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); Composite dialogArea = (Composite) super.createDialogArea(parent); dialogArea.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); Composite composite = new Composite(dialogArea, SWT.BORDER); composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); composite.setLayout(new GridLayout(1, false)); composite.setSize(new Point(logoWidth + 200, logoHeight * 4)); GridData gd_composite = new GridData(SWT.CENTER, SWT.TOP, true, true, 1, 1); gd_composite.widthHint = logoWidth + 200; gd_composite.heightHint = logoHeight * 4; composite.setLayoutData(gd_composite); Label lblDevsLogo = new Label(composite, SWT.NONE); lblDevsLogo.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); lblDevsLogo.setImage(logoImage); GridData gdDevsLogo = new GridData(SWT.CENTER, SWT.TOP, false, false, 1, 1); gdDevsLogo.widthHint = logoWidth; gdDevsLogo.heightHint = logoHeight; lblDevsLogo.setLayoutData(gdDevsLogo); Label lblVersion = new Label(composite, SWT.NONE); lblVersion.setForeground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BORDER)); lblVersion.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); lblVersion.setText(KERNAL_MSG.concat(getVersion())); Label lblLicense = new Label(composite, SWT.NONE); lblLicense.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); lblLicense.setText(LICENSED); Link linkDevStudioUrl = new Link(composite, SWT.NONE); linkDevStudioUrl.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); linkDevStudioUrl.setText("Visit :<a>" + URL + "</a>"); linkDevStudioUrl.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { org.eclipse.swt.program.Program.launch(URL); } }); addProductIcons(composite); return dialogArea; }
Example 6
Source File: FeatureEnvy.java From JDeodorant with MIT License | 4 votes |
protected Composite createToolTipContentArea(Event event, Composite parent) { Composite comp = new Composite(parent,SWT.NONE); GridLayout gl = new GridLayout(1,false); gl.marginBottom=0; gl.marginTop=0; gl.marginHeight=0; gl.marginWidth=0; gl.marginLeft=0; gl.marginRight=0; gl.verticalSpacing=1; comp.setLayout(gl); Composite topArea = new Composite(comp,SWT.NONE); GridData data = new GridData(SWT.FILL,SWT.FILL,true,false); data.widthHint=200; topArea.setLayoutData(data); topArea.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); gl = new GridLayout(1,false); gl.marginBottom=2; gl.marginTop=2; gl.marginHeight=0; gl.marginWidth=0; gl.marginLeft=5; gl.marginRight=2; topArea.setLayout(gl); Label label = new Label(topArea,SWT.NONE); label.setText("APPLY FIRST"); label.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); label.setFont(JFaceResources.getFontRegistry().get(HEADER_FONT)); //label.setForeground(JFaceResources.getColorRegistry().get(HEADER_FG_COLOR)); label.setLayoutData(new GridData(GridData.FILL_BOTH)); Table table = tableViewer.getTable(); Point coords = new Point(event.x, event.y); TableItem item = table.getItem(coords); if(item != null) { List<CandidateRefactoring> prerequisiteRefactorings = getPrerequisiteRefactorings((CandidateRefactoring)item.getData()); if(!prerequisiteRefactorings.isEmpty()) { final CandidateRefactoring firstPrerequisite = prerequisiteRefactorings.get(0); Composite comp2 = new Composite(comp,SWT.NONE); comp2.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); FillLayout layout = new FillLayout(); layout.marginWidth=5; comp2.setLayout(layout); Link link = new Link(comp2,SWT.NONE); link.setText("<a>" + firstPrerequisite.getSourceEntity() + "\n->" + firstPrerequisite.getTarget() + "</a>"); link.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); link.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { setSelectedLine(firstPrerequisite); } }); comp2.setLayoutData(new GridData(GridData.FILL_BOTH)); } } return comp; }