本文整理汇总了Java中org.eclipse.swt.widgets.Label.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java Label.setBackground方法的具体用法?Java Label.setBackground怎么用?Java Label.setBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Label
的用法示例。
在下文中一共展示了Label.setBackground方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createViewerToolTipContentArea
import org.eclipse.swt.widgets.Label; //导入方法依赖的package包/类
@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;
}
示例2: createTopContent
import org.eclipse.swt.widgets.Label; //导入方法依赖的package包/类
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();
});
}
示例3: InfoBar
import org.eclipse.swt.widgets.Label; //导入方法依赖的package包/类
/**
* 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);
}
示例4: createComposite
import org.eclipse.swt.widgets.Label; //导入方法依赖的package包/类
/**
* 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");
}
示例5: addLookupConfigurationDetailsInTooltip
import org.eclipse.swt.widgets.Label; //导入方法依赖的package包/类
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);
}
示例6: createLabelledCombo
import org.eclipse.swt.widgets.Label; //导入方法依赖的package包/类
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;
}
示例7: addToolTipTextArea
import org.eclipse.swt.widgets.Label; //导入方法依赖的package包/类
/**
* 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");
}
示例8: setExternalSchemaInTooltip
import org.eclipse.swt.widgets.Label; //导入方法依赖的package包/类
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;
}
示例9: addJoinKeysInTooltip
import org.eclipse.swt.widgets.Label; //导入方法依赖的package包/类
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);
}
示例10: addRecordRequiredInTooltip
import org.eclipse.swt.widgets.Label; //导入方法依赖的package包/类
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));
}
示例11: addPropertyInTooltipWindow
import org.eclipse.swt.widgets.Label; //导入方法依赖的package包/类
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;
}
示例12: createStatsView
import org.eclipse.swt.widgets.Label; //导入方法依赖的package包/类
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;
}
示例13: StatusPanel
import org.eclipse.swt.widgets.Label; //导入方法依赖的package包/类
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();
}
示例14: createFakeToolTip
import org.eclipse.swt.widgets.Label; //导入方法依赖的package包/类
/**
* 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));
}
示例15: XYZDisplayComp
import org.eclipse.swt.widgets.Label; //导入方法依赖的package包/类
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();
}
});
}