Java Code Examples for org.eclipse.swt.custom.CLabel#setBackground()
The following examples show how to use
org.eclipse.swt.custom.CLabel#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: ViewFilterDialog.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
private void createCLabels(Composite parent, Composite labels, String currentRegex) { CLabel filter = new CLabel(labels, SWT.BORDER); filter.setText(currentRegex); filter.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_DELETE)); filter.setBackground(fColorScheme.getColor(TimeGraphColorScheme.TOOL_BACKGROUND)); filter.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e2) { deleteCLabel(parent, filter, e2); } }); parent.layout(); Rectangle bounds = parent.getShell().getBounds(); Point size = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT); Rectangle trim = parent.getShell().computeTrim(0, 0, size.x, size.y); parent.getShell().setBounds(bounds.x + bounds.width - trim.width, bounds.y + bounds.height - trim.height, trim.width, trim.height); }
Example 2
Source File: ViewUtils.java From http4e with Apache License 2.0 | 5 votes |
static ViewForm buildViewForm( final String title, final ItemModel model, final Composite parent){ final ViewForm vForm = new ViewForm(parent, SWT.NONE); // -- Label(vForm) final CLabel label = new CLabel(vForm, SWT.NONE); label.setText(CoreConstants.TITLE_SPACE + title + CoreConstants.TITLE_SPACE); label.setAlignment(SWT.LEFT); label.setBackground(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.TITLE_LINE)); label.addMouseListener(new MouseAdapter() { public void mouseDoubleClick( MouseEvent e){ int eventType = ModelEvent.UNKNOWN; if (CoreConstants.TITLE_HEADERS.equals(title)) { eventType = ModelEvent.HEADERS_RESIZED; } else if (CoreConstants.TITLE_PARAMETERS.equals(title)) { eventType = ModelEvent.PARAMS_RESIZED; } else if (CoreConstants.TITLE_BODY.equals(title)) { eventType = ModelEvent.BODY_RESIZED; } else if (CoreConstants.TITLE_REQUEST.equals(title)) { eventType = ModelEvent.REQUEST_RESIZED; } else if (CoreConstants.TITLE_RESPONSE.equals(title)) { eventType = ModelEvent.RESPONSE_RESIZED; } model.fireExecute(new ModelEvent(eventType, model)); } }); vForm.setTopLeft(label); return vForm; }
Example 3
Source File: DomainStatusLabel.java From statecharts with Eclipse Public License 1.0 | 5 votes |
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 4
Source File: XSPEditorUtil.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
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 5
Source File: ConnectionStateComposite.java From saros with GNU General Public License v2.0 | 5 votes |
public ConnectionStateComposite(Composite parent, int style) { super(parent, style); SarosPluginContext.initComponent(this); setLayout(LayoutUtils.createGridLayout(1, false, 10, 3, 0, 0)); stateLabel = new CLabel(this, SWT.NONE); stateLabel.setLayoutData(LayoutUtils.createFillHGrabGridData()); FontUtils.makeBold(stateLabel); stateLabel.setForeground(getDisplay().getSystemColor(SWT.COLOR_WHITE)); stateLabel.setBackground(getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY)); setBackground(getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY)); connectionHandler.addConnectionStateListener(connectionListener); accountStore.addListener(accountStoreListener); updateLabel(connectionHandler.getConnectionState(), connectionHandler.getConnectionError()); addDisposeListener( new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { connectionHandler.removeConnectionStateListener(connectionListener); accountStore.removeListener(accountStoreListener); } }); }
Example 6
Source File: PShelfStackPresentation.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public void addPart(final IPresentablePart newPart, Object cookie) { ignoreSelection = true; final PShelfItem item = new PShelfItem(shelf,SWT.NONE); ignoreSelection = false; item.setData(DATAKEY_PART,newPart); item.getBody().setLayout(null); item.getBody().addListener(SWT.Paint, new Listener() { public void handleEvent(Event e) { Integer separatorY = (Integer)item.getBody().getData(DATAKEY_SEPHEIGHT); if (separatorY == null) return; e.gc.setForeground(border); e.gc.drawLine(0,separatorY.intValue(),item.getBody().getSize().x,separatorY.intValue()); } }); CLabel descLabel = new CLabel(item.getBody(),SWT.WRAP); item.setData(DATAKEY_DESCLABEL,descLabel); descLabel.setBackground(toolbarBackground); ToolBar tb = new ToolBar(item.getBody(),SWT.NONE); item.setData(DATAKEY_MENUTOOL,tb); tb.setBackground(toolbarBackground); updateItem(newPart); newPart.addPropertyListener(new IPropertyListener() { public void propertyChanged(Object source, int propId) { updateItem(newPart); } }); }
Example 7
Source File: FormWidgetFactory.java From birt with Eclipse Public License 1.0 | 3 votes |
/** * Creates a label as a part of the form. * * @param parent * the label parent. * @param text * the label text. * @param style * the label style. * @return the label. */ public CLabel createCLabel( Composite parent, String text, int style ) { final CLabel label = new CLabel( parent, style ); label.setBackground( parent.getBackground( ) ); label.setText( text ); return label; }
Example 8
Source File: TabbedPropertySheetWidgetFactory.java From bonita-studio with GNU General Public License v2.0 | 3 votes |
/** * Creates a label as a part of the form. * * @param parent * the label parent. * @param text * the label text. * @param style * the label style. * @return the label. */ public CLabel createCLabel(Composite parent, String text, int style) { final CLabel label = new CLabel(parent, style); label.setBackground(parent.getBackground()); label.setText(text); return label; }