本文整理汇总了Java中org.eclipse.swt.custom.CLabel.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java CLabel.setBackground方法的具体用法?Java CLabel.setBackground怎么用?Java CLabel.setBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.custom.CLabel
的用法示例。
在下文中一共展示了CLabel.setBackground方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addStats
import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
private void addStats() {
for (String key : statsProject.keySet()) {
if (key != project.getName()) {
CLabel title = new CLabel(descriptifRight, SWT.BOLD);
title.setText(key);
title.setImage(new Image(display, getClass()
.getResourceAsStream(
"images/stats_"
+ key.replaceAll(" ", "_")
.toLowerCase() + "_16x16.png")));
title.setBackground(new Color(display, 255, 255, 255));
title.setMargins(10, 10, 0, 0);
FontData[] fd = title.getFont().getFontData();
fd[0].setStyle(SWT.BOLD);
title.setFont(new Font(title.getFont().getDevice(), fd));
CLabel subText = new CLabel(descriptifRight, SWT.NONE);
subText.setText(statsProject.get(key)
.replaceAll("<br/>", "\r\n").replaceAll(" ", " "));
subText.setBackground(new Color(display, 255, 255, 255));
subText.setMargins(30, 0, 0, 0);
}
}
}
示例2: populate
import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
private void populate() {
final Color backgroundColor = getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
final FillLayout layout = new FillLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
setLayout(layout);
setBackground(backgroundColor);
label = new CLabel(this, SWT.LEFT);
label.setBackground(backgroundColor);
attachWorkItemListeners();
addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(final DisposeEvent e) {
onDispose();
}
});
}
示例3: createUI_26_SmoothAltitude
import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
private void createUI_26_SmoothAltitude(final Composite parent) {
/*
* image: altitude
*/
_iconAltitude = new CLabel(parent, SWT.NONE);
GridDataFactory.fillDefaults().indent(16, 0).applyTo(_iconAltitude);
_iconAltitude.setBackground(_tk.getColors().getBackground());
_iconAltitude.setImage(_imageAltitude);
/*
* checkbox: smooth altitude
*/
_chkIsAltitudeSmoothing = _tk.createButton(
parent,
Messages.TourChart_Smoothing_Checkbox_IsAltitudeSmoothing,
SWT.CHECK);
GridDataFactory.fillDefaults() //
.align(SWT.FILL, SWT.CENTER)
.span(2, 1)
.applyTo(_chkIsAltitudeSmoothing);
_chkIsAltitudeSmoothing.setToolTipText(Messages.TourChart_Smoothing_Checkbox_IsAltitudeSmoothing_Tooltip);
_chkIsAltitudeSmoothing.addSelectionListener(_selectionListener);
}
示例4: createContextButton
import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
protected CLabel createContextButton (String text, Image icon)
{
CLabel lbl = new CLabel(buttonsContainer, SWT.NONE);
lbl.setLayoutData(new RowData(SWT.DEFAULT, 28));
lbl.setRightMargin(10);
lbl.setLeftMargin(8);
lbl.setText(text);
lbl.setImage(icon);
lbl.setBackground(ColorResources.COLOR_CS_BLUE);
lbl.setForeground(ColorResources.COLOR_WHITE);
lbl.setCursor(new Cursor(getDisplay(), SWT.CURSOR_HAND));
contextButtonsMap.put(lbl, text);
return lbl;
}
示例5: createPositionButton
import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
private Composite createPositionButton(final Composite content, final String propName, String label, String iconPath) {
final CLabel position = new CLabel(content, SWT.LEFT);
position.setBackground(content.getDisplay().getSystemColor(SWT.COLOR_WHITE));
position.setImage(Activator.getImageDescriptor(iconPath).createImage());
position.setText(label);
position.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
GridUtils.setVisible(position, store.getBoolean(propName));
return position;
}
示例6: EditorStatusControl
import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
public EditorStatusControl(final Composite parent, final int style) {
super(parent, style);
final Color backgroundColor = getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
final FillLayout layout = new FillLayout();
layout.marginHeight = 1;
layout.marginWidth = 1;
setLayout(layout);
setBackground(backgroundColor);
label = new CLabel(this, SWT.LEFT);
label.setBackground(backgroundColor);
}
示例7: buildViewForm
import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
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;
}
示例8: createLabel
import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
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()));
}
示例9: createLabel
import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
private void createLabel(String text, Shell shell, Control control) {
CLabel idLabel = new CLabel(shell, SWT.NONE);
idLabel.setText(text);
FormData data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(control, -HSPACE);
data.top = new FormAttachment(control, 0, SWT.TOP);
idLabel.setLayoutData(data);
idLabel.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
}
示例10: createLabel
import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
private CLabel createLabel(Composite parent, String text, Control control) {
CLabel label = new CLabel(parent, SWT.NONE);
label.setText(text);
FormData data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(control, -HSPACE);
data.top = new FormAttachment(control, 0, SWT.TOP);
label.setLayoutData(data);
label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
return label;
}
示例11: createUI_20_SmoothSpeed
import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
private void createUI_20_SmoothSpeed(final Composite parent) {
/*
* image: speed
*/
_iconSpeed = new CLabel(parent, SWT.NONE);
GridDataFactory.fillDefaults().indent(16, 0).applyTo(_iconSpeed);
_iconSpeed.setBackground(_tk.getColors().getBackground());
_iconSpeed.setImage(_imageSpeed);
/*
* label: smooth speed
*/
final Label label = _tk.createLabel(parent, Messages.TourChart_Smoothing_Label_SpeedSmoothing);
GridDataFactory.fillDefaults() //
.align(SWT.FILL, SWT.CENTER)
.applyTo(label);
label.setToolTipText(Messages.TourChart_Smoothing_Label_SpeedSmoothing_Tooltip);
/*
* spinner: tau
*/
_spinnerSpeedTau = new Spinner(parent, SWT.BORDER);
GridDataFactory.fillDefaults()//
.align(SWT.BEGINNING, SWT.FILL)
.applyTo(_spinnerSpeedTau);
_spinnerSpeedTau.setDigits(1);
_spinnerSpeedTau.setMinimum(1);
_spinnerSpeedTau.setMaximum(MAX_TAU);
_spinnerSpeedTau.addSelectionListener(_selectionListener);
_spinnerSpeedTau.addMouseWheelListener(_spinnerMouseWheelListener);
}
示例12: createUI_22_SmoothGradient
import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
private void createUI_22_SmoothGradient(final Composite parent) {
/*
* image: gradient
*/
_iconGradient = new CLabel(parent, SWT.NONE);
GridDataFactory.fillDefaults().indent(16, 0).applyTo(_iconGradient);
_iconGradient.setBackground(_tk.getColors().getBackground());
_iconGradient.setImage(_imageGradient);
/*
* label: smooth gradient
*/
final Label label = _tk.createLabel(parent, Messages.TourChart_Smoothing_Label_GradientSmoothing, SWT.CHECK);
GridDataFactory.fillDefaults() //
.align(SWT.FILL, SWT.CENTER)
.applyTo(label);
label.setToolTipText(Messages.TourChart_Smoothing_Label_GradientSmoothing_Tooltip);
/*
* spinner: gradient tau
*/
_spinnerGradientTau = new Spinner(parent, SWT.BORDER);
GridDataFactory.fillDefaults()//
.align(SWT.BEGINNING, SWT.FILL)
.applyTo(_spinnerGradientTau);
_spinnerGradientTau.setDigits(1);
_spinnerGradientTau.setMinimum(1);
_spinnerGradientTau.setMaximum(MAX_TAU);
_spinnerGradientTau.addSelectionListener(_selectionListener);
_spinnerGradientTau.addMouseWheelListener(_spinnerMouseWheelListener);
}
示例13: createUI_24_SmoothPulse
import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
private void createUI_24_SmoothPulse(final Composite parent) {
/*
* image: pulse
*/
_iconPulse = new CLabel(parent, SWT.NONE);
GridDataFactory.fillDefaults().indent(16, 0).applyTo(_iconPulse);
_iconPulse.setBackground(_tk.getColors().getBackground());
_iconPulse.setImage(_imagePulse);
/*
* checkbox: smooth speed
*/
_chkIsPulseSmoothing = _tk.createButton(
parent,
Messages.TourChart_Smoothing_Checkbox_IsPulseSmoothing,
SWT.CHECK);
GridDataFactory.fillDefaults() //
.align(SWT.FILL, SWT.CENTER)
.applyTo(_chkIsPulseSmoothing);
_chkIsPulseSmoothing.addSelectionListener(_selectionListener);
_chkIsPulseSmoothing.setToolTipText(Messages.TourChart_Smoothing_Checkbox_IsPulseSmoothing_Tooltip);
/*
* spinner: speed tau
*/
_spinnerPulseTau = new Spinner(parent, SWT.BORDER);
GridDataFactory.fillDefaults()//
.align(SWT.BEGINNING, SWT.FILL)
.applyTo(_spinnerPulseTau);
_spinnerPulseTau.setDigits(1);
_spinnerPulseTau.setMinimum(1);
_spinnerPulseTau.setMaximum(MAX_TAU);
_spinnerPulseTau.addSelectionListener(_selectionListener);
_spinnerPulseTau.addMouseWheelListener(_spinnerMouseWheelListener);
}
示例14: createToolTipContentArea
import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
/**
* Creates the content are of the the tooltip. By default this creates a
* CLabel to display text. To customize the text Subclasses may override the
* following methods
* <ul>
* <li>{@link #getStyle(Event)}</li>
* <li>{@link #getBackgroundColor(Event)}</li>
* <li>{@link #getForegroundColor(Event)}</li>
* <li>{@link #getFont(Event)}</li>
* <li>{@link #getImage(Event)}</li>
* <li>{@link #getText(Event)}</li>
* <li>{@link #getBackgroundImage(Event)}</li>
* </ul>
*
* @param event
* the event that triggered the activation of the tooltip
* @param parent
* the parent of the content area
* @return the content area created
*/
protected Composite createToolTipContentArea(Event event, Composite parent) {
Image image = getImage(event);
Image bgImage = getBackgroundImage(event);
String text = getText(event);
Color fgColor = getForegroundColor(event);
Color bgColor = getBackgroundColor(event);
Font font = getFont(event);
CLabel label = new CLabel(parent, getStyle(event));
if (text != null) {
label.setText(text);
}
if (image != null) {
label.setImage(image);
}
if (fgColor != null) {
label.setForeground(fgColor);
}
if (bgColor != null) {
label.setBackground(bgColor);
}
if (bgImage != null) {
label.setBackgroundImage(image);
}
if (font != null) {
label.setFont(font);
}
return label;
}
示例15: createCLabel
import org.eclipse.swt.custom.CLabel; //导入方法依赖的package包/类
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;
}