本文整理汇总了Java中org.eclipse.swt.widgets.Composite.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java Composite.setBackground方法的具体用法?Java Composite.setBackground怎么用?Java Composite.setBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Composite
的用法示例。
在下文中一共展示了Composite.setBackground方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createViewerToolTipContentArea
import org.eclipse.swt.widgets.Composite; //导入方法依赖的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.Composite; //导入方法依赖的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: createButtonBar
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
@Override
protected Control createButtonBar(Composite parent) {
final Composite buttonBar = new Composite(parent, SWT.NONE);
buttonBar.setBackground(backColor);
final GridLayout layout = new GridLayout();
layout.marginLeft = 10;
layout.numColumns = 2;
layout.makeColumnsEqualWidth = false;
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
buttonBar.setLayout(layout);
final GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = false;
buttonBar.setLayoutData(data);
buttonBar.setFont(parent.getFont());
// add the dialog's button bar to the right
buttonControl = super.createButtonBar(buttonBar);
buttonControl.setBackground(backColor);
buttonControl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
return buttonBar;
}
示例4: createComposite
import org.eclipse.swt.widgets.Composite; //导入方法依赖的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: createPartControl
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
public void createPartControl(Composite parent) {
try {
parent.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
GridLayout gridLayout = new GridLayout();
parent.setLayout(gridLayout);
gridLayout.horizontalSpacing = 0;
gridLayout.marginWidth = 0;
gridLayout.marginHeight = 0;
gridLayout.verticalSpacing = 0;
GridData gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.verticalAlignment = GridData.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
ConnectorEditorInput connectorEditorInput = (ConnectorEditorInput) getEditorInput();
connectorEditorPart = new ConnectorEditorPart(this, connectorEditorInput.connector, parent, SWT.None);
connectorEditorPart.setLayoutData(gridData);
}
catch(Throwable e) {
ConvertigoPlugin.logException(e, "Unable to create editor part");
}
}
示例6: createComposite
import org.eclipse.swt.widgets.Composite; //导入方法依赖的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);
}
示例7: createPartControl
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
public void createPartControl(Composite parent) {
try {
parent.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
GridLayout gridLayout = new GridLayout();
parent.setLayout(gridLayout);
gridLayout.horizontalSpacing = 0;
gridLayout.marginWidth = 0;
gridLayout.marginHeight = 0;
gridLayout.verticalSpacing = 0;
GridData gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.verticalAlignment = GridData.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
SequenceEditorInput sequenceEditorInput = (SequenceEditorInput) getEditorInput();
sequenceEditorPart = new SequenceEditorPart(this, sequenceEditorInput.sequence, parent, SWT.None);
sequenceEditorPart.setLayoutData(gridData);
}
catch(Throwable e) {
ConvertigoPlugin.logException(e, "Unable to create editor part");
}
}
示例8: setPositionSelected
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
protected void setPositionSelected(Composite position, List<Composite> positions, String propName, DelegatingSelectionProvider prov) {
position.setFocus();
seriesTable.deselectAll();
for (Composite composite : positions) composite.setBackground(position.getDisplay().getSystemColor(SWT.COLOR_WHITE));
position.setBackground(position.getDisplay().getSystemColor(SWT.COLOR_TITLE_BACKGROUND));
seriesTable.addSelectionListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
position.setBackground(position.getDisplay().getSystemColor(SWT.COLOR_WHITE));
seriesTable.removeSelectionListener(this);
}
});
if (trees.containsKey(propName)) prov.fireSelection(new StructuredSelection(trees.get(propName)));
}
示例9: HydroGroup
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
/**
* Create the composite.
* @param parent
* @param style
*/
public HydroGroup(Composite parent, int style) {
super(parent, style);
setLayout(new GridLayout(1, false));
setData("org.eclipse.e4.ui.css.id", "HydrographGroup");
hydroGroupLabel = new CLabel(this, SWT.NONE);
hydroGroupLabel.setText("Hydro Group Label");
hydroGroupLabel.setData("org.eclipse.e4.ui.css.id", "HydroGroupLabel");
hydroGroupBorder = new Composite(this, SWT.NONE);
hydroGroupBorder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
GridLayout gl_hydroGroupBorder = new GridLayout(1, false);
gl_hydroGroupBorder.verticalSpacing = 1;
gl_hydroGroupBorder.marginWidth = 1;
gl_hydroGroupBorder.marginHeight = 1;
gl_hydroGroupBorder.horizontalSpacing = 1;
hydroGroupBorder.setLayout(gl_hydroGroupBorder);
hydroGroupBorder.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 0, 0, 0));
hydroGroupBorder.setData("org.eclipse.e4.ui.css.id", "HydroGroupBorder");
hydroGroupClientArea = new Composite(hydroGroupBorder, SWT.NONE);
hydroGroupClientArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
hydroGroupClientArea.setData("org.eclipse.e4.ui.css.id", "HydroGroupClientArea");
}
示例10: createLineContent
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
private void createLineContent() {
Composite middle = new Composite(composite, SWT.NONE);
middle.setBackground(backColor);
middle.setLayout(new GridLayout(1, false));
middle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
middle.addPaintListener(e -> {
e.gc.setForeground(display.getSystemColor(SWT.COLOR_GRAY));
e.gc.drawLine(0, 0, middle.getBounds().width, 1);
});
}
示例11: createBottomContent
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
protected Composite createBottomContent() {
Composite bottom = new Composite(composite, SWT.NONE);
bottom.setBackground(backColor);
GridLayout layout = new GridLayout(2, true);
layout.marginTop = 0;
layout.marginLeft = 20;
layout.marginRight = 20;
bottom.setLayout(layout);
bottom.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
return bottom;
}
示例12: createCompositeOutputHeader
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
/**
* This method initializes compositeOutputHeader
*
*/
private void createCompositeOutputHeader() {
final Color background = getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
GridLayout gridLayout3 = new GridLayout();
gridLayout3.numColumns = 2;
GridData gridData1 = new org.eclipse.swt.layout.GridData();
gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
gridData1.grabExcessHorizontalSpace = true;
gridData1.grabExcessVerticalSpace = false;
gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
compositeOutputHeader = new Composite(compositeOutput, SWT.NONE);
compositeOutputHeader.setBackground(background);
compositeOutputHeader.setLayoutData(gridData1);
compositeOutputHeader.setLayout(gridLayout3);
createToolBar();
GridData gridData6 = new org.eclipse.swt.layout.GridData();
gridData6.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
gridData6.heightHint = 16;
gridData6.widthHint = 104;
gridData6.verticalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
canvas = new Canvas(compositeOutputHeader, SWT.NONE);
canvas.setLayoutData(gridData6);
canvas.setVisible(true);
}
示例13: createCompositeOutputHeader
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
private void createCompositeOutputHeader() {
final Color background = getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
GridLayout gridLayout3 = new GridLayout();
gridLayout3.numColumns = 2;
GridData gridData1 = new org.eclipse.swt.layout.GridData();
gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
gridData1.grabExcessHorizontalSpace = true;
gridData1.grabExcessVerticalSpace = false;
gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
compositeOutputHeader = new Composite(compositeOutput, SWT.NONE);
compositeOutputHeader.setBackground(background);
compositeOutputHeader.setLayoutData(gridData1);
compositeOutputHeader.setLayout(gridLayout3);
createToolBar();
GridData gridData6 = new org.eclipse.swt.layout.GridData();
gridData6.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
gridData6.heightHint = 16;
gridData6.widthHint = 104;
gridData6.verticalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
canvas = new Canvas(compositeOutputHeader, SWT.NONE);
canvas.setLayoutData(gridData6);
canvas.setVisible(false);
}
示例14: createToolTipContainer
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
/**
* Creates container for tooltip
* @param parent
* @param scrolledComposite
* @return
*/
private Composite createToolTipContainer(Composite parent,
ScrolledComposite scrolledComposite) {
final Composite container = addComposite(scrolledComposite);
container.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
addToolTipContainerFocusListener(container);
logger.debug("ComponentTooltip.createToolTipContainer() - created Tooltip container " + container);
return container;
}
示例15: populateHeader
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
private void populateHeader(Composite header) {
header.setBackground(Colors.getSystemColor(display, SWT.COLOR_WHITE));
title = new Label(header, SWT.WRAP);
title.setFont(titleFont);
FillLayout layout = new FillLayout();
layout.marginHeight = 10;
layout.marginWidth = 10;
header.setLayout(layout);
}