本文整理汇总了Java中org.eclipse.swt.custom.CLabel类的典型用法代码示例。如果您正苦于以下问题:Java CLabel类的具体用法?Java CLabel怎么用?Java CLabel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CLabel类属于org.eclipse.swt.custom包,在下文中一共展示了CLabel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DataItemLabel
import org.eclipse.swt.custom.CLabel; //导入依赖的package包/类
public DataItemLabel ( final Composite composite, final String connectionId, final String itemId )
{
this.label = new CLabel ( composite, SWT.NONE );
this.dataItem = new DataItemObservableValue ( Activator.getDefault ().getBundle ().getBundleContext (), connectionId, itemId );
this.label.addDisposeListener ( new DisposeListener () {
@Override
public void widgetDisposed ( final DisposeEvent e )
{
handleDispose ();
}
} );
this.model = PojoObservables.observeDetailValue ( this.dataItem, "value", Variant.class ); //$NON-NLS-1$
this.dbc = new DataBindingContext ();
bind ();
}
示例2: 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);
}
}
}
示例3: HydroGroup
import org.eclipse.swt.custom.CLabel; //导入依赖的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");
}
示例4: updateTooltipLanguageFromData
import org.eclipse.swt.custom.CLabel; //导入依赖的package包/类
public static void updateTooltipLanguageFromData(Widget widget) {
if (widget == null || widget.isDisposed()) {
return;
}
if (widget.getData() != null) {
String sToolTip = MessageText.getString((String) widget.getData());
if (widget instanceof CLabel)
((CLabel) widget).setToolTipText(sToolTip);
else if (widget instanceof Label)
((Label) widget).setToolTipText(sToolTip);
else if (widget instanceof Text)
((Text) widget).setToolTipText(sToolTip);
else if (widget instanceof Canvas)
((Canvas) widget).setToolTipText(sToolTip);
else if (widget instanceof Composite)
((Composite) widget).setToolTipText(sToolTip);
else if (widget instanceof Control)
((Control) widget).setToolTipText(sToolTip);
else
System.out.println("No cast for " + widget.getClass().getName());
}
}
示例5: 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();
}
});
}
示例6: createLabel
import org.eclipse.swt.custom.CLabel; //导入依赖的package包/类
/**
* Creates a label for a knob
* @param root
* @param knob
*/
private CLabel createLabel(final Composite root,
final Knob<Double> knob) {
// Label
String text = "100%"; //$NON-NLS-1$
final CLabel label = new CLabel(root, SWT.NONE);
label.setText(text);
label.setAlignment(SWT.LEFT);
label.setLayoutData(SWTUtil.createFillGridData());
label.setToolTipText(text);
// Listen
knob.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
updateLabel(knob, label);
}
});
// Return
return label;
}
示例7: createMainComposite
import org.eclipse.swt.custom.CLabel; //导入依赖的package包/类
/**
* @see nexcore.tool.uml.ui.property.section.AbstractPropertyCommonSection#createMainComposite()
*/
@Override
public void createMainComposite() {
sectionComposite = getWidgetFactory().createComposite(parent);
sectionLayout = new GridLayout(2, false);
sectionComposite.setLayout(sectionLayout);
CLabel visibilityLabel = getWidgetFactory().createCLabel(sectionComposite,
UMLMessage.LABEL_VISIBILITY + UICoreConstant.UMLSECTION_CONSTANTS__COLON_TEXT); //$NON-NLS-1$
gridData = new GridData();
Composite visibilityComposite = getWidgetFactory().createComposite(sectionComposite);
sectionLayout = new GridLayout(4, false);
visibilityComposite.setLayout(sectionLayout);
gridData.widthHint = UICoreConstant.UMLSECTION_CONSTANTS___LABEL_WIDTH_HINT_FOR_RADIO;
visibilityLabel.setLayoutData(gridData);
publicButton = getWidgetFactory().createButton(visibilityComposite, UMLMessage.LABEL_PUBLIC, SWT.RADIO);
privateButton = getWidgetFactory().createButton(visibilityComposite, UMLMessage.LABEL_PRIVATE, SWT.RADIO);
protectedButton = getWidgetFactory().createButton(visibilityComposite, UMLMessage.LABEL_PROTECTED, SWT.RADIO);
packageButton = getWidgetFactory().createButton(visibilityComposite, UMLMessage.LABEL_PACKAGE, SWT.RADIO);
}
示例8: createDialogArea
import org.eclipse.swt.custom.CLabel; //导入依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
Composite control = new Composite(parent, SWT.NONE);
control.setLayout(new GridLayout(2, true));
Composite imageControl = new Composite(control, SWT.BORDER);
imageControl.setLayout(new FillLayout());
imageControl.setLayoutData(new GridData(GridData.FILL_VERTICAL));
Label imageLabel = new Label(imageControl, SWT.CENTER);
imageLabel.setImage(mAboutImage);
CLabel textLabel = new CLabel(control, SWT.NONE);
// TODO: update with new year date (search this to find other occurrences to update)
textLabel.setText("Hierarchy Viewer\nCopyright 2012, The Android Open Source Project\nAll Rights Reserved.");
textLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, true));
getShell().setText("About...");
getShell().setImage(mSmallImage);
return control;
}
示例9: initGUI
import org.eclipse.swt.custom.CLabel; //导入依赖的package包/类
private void initGUI() {
try {
RowLayout thisLayout = new RowLayout(org.eclipse.swt.SWT.HORIZONTAL);
thisLayout.pack = false;
thisLayout.justify = true;
thisLayout.fill = true;
this.setLayout(thisLayout);
jLabel1 = new CLabel(this, SWT.NONE);
jLabel1.setText("Flower:");
jLabel2 = new CLabel(this, SWT.NONE);
jLabel2.setText("(Family)");
flowerLabel = new CLabel(this, SWT.NONE);
flowerLabel.setText("$NAME$");
jLabel3 = new CLabel(this, SWT.NONE);
jLabel3.setText("Quantity:");
quantityTextField = new Text(this, SWT.NONE);
} catch (Exception e) {
e.printStackTrace();
}
}
示例10: createWidget4Property
import org.eclipse.swt.custom.CLabel; //导入依赖的package包/类
public ASPropertyWidget createWidget4Property(APropertyNode element, Composite composite, Object property,
boolean showLabel) {
if (element != null) {
IPropertyDescriptor[] pds = element.getPropertyDescriptors();
for (IPropertyDescriptor pd : pds) {
if (pd.getId().equals(property)) {
CLabel label = createLabel(composite, showLabel, pd);
ASPropertyWidget widget = SPWidgetFactory.createWidget(composite, this, pd);
if (widget != null) {
widget.setLabel(label);
widgets.put(pd.getId(), widget);
return widget;
}
break;
}
}
}
return null;
}
示例11: createControls
import org.eclipse.swt.custom.CLabel; //导入依赖的package包/类
/**
* @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite,
* org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
*/
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
super.createControls(parent, tabbedPropertySheetPage);
parent = getWidgetFactory().createSection(parent, Messages.SizeSection_sizeSectionTitle, true, 4);
section = (ExpandableComposite)parent.getParent();
ASPropertyWidget hw = createWidget4Property(parent, JRDesignElement.PROPERTY_WIDTH);
CLabel lbl = hw.getLabel();
lbl.setText(Messages.SizeSection_widthLabel);
lbl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
hw = createWidget4Property(parent, JRDesignElement.PROPERTY_HEIGHT);
lbl = hw.getLabel();
lbl.setText(Messages.SizeSection_heightLabel);
lbl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
ASPropertyWidget w = createWidget4Property(parent, JRDesignElement.PROPERTY_STRETCH_TYPE);
GridData gd = new GridData();
gd.horizontalSpan = 3;
w.getControl().setLayoutData(gd);
}
示例12: createControls
import org.eclipse.swt.custom.CLabel; //导入依赖的package包/类
/**
* @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite,
* org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
*/
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
super.createControls(parent, tabbedPropertySheetPage);
parent = getWidgetFactory().createSection(parent, Messages.LocationSection_locationLabel, true, 4);
section = (ExpandableComposite)parent.getParent();
ASPropertyWidget pw = createWidget4Property(parent, JRDesignElement.PROPERTY_X);
CLabel lbl = pw.getLabel();
lbl.setText(Messages.LocationSection_xCoordinateLabel);
lbl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
pw = createWidget4Property(parent, JRDesignElement.PROPERTY_Y);
lbl = pw.getLabel();
lbl.setText(Messages.LocationSection_yCoordinateLabel);
lbl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
ASPropertyWidget w = createWidget4Property(parent, JRDesignElement.PROPERTY_POSITION_TYPE);
GridData gd = new GridData();
gd.horizontalSpan = 3;
w.getControl().setLayoutData(gd);
}
示例13: createUI
import org.eclipse.swt.custom.CLabel; //导入依赖的package包/类
public void createUI(Composite cParent) {
Label spcStatus = new Label(cParent, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_IN);
spcStatus.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
Composite pStatus = new Composite(cParent, SWT.NO_FOCUS);
pStatus.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
GridLayout gl_pStatus = new GridLayout(4, false);
gl_pStatus.marginTop = 1;
gl_pStatus.marginBottom = 2;
gl_pStatus.marginHeight = 0;
gl_pStatus.verticalSpacing = 0;
pStatus.setLayout(gl_pStatus);
pStatus.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
lStatus = new CLabel(pStatus, SWT.NONE);
lStatus.setLeftMargin(3);
lStatus.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
lStatus.setRightMargin(5);
lStatus.setTopMargin(2);
lStatus.setBottomMargin(1);
setPortStatus("Port closed", false);
createLeds(pStatus);
}
示例14: createLeds
import org.eclipse.swt.custom.CLabel; //导入依赖的package包/类
protected void createLeds(Composite parent) {
Composite pSigstate = new Composite(parent, SWT.NONE);
GridLayout gl_pSigstate = new GridLayout(6, true);
gl_pSigstate.marginHeight = 0;
pSigstate.setLayout(gl_pSigstate);
createLed(pSigstate, Serial.Pin.RXD);
createLed(pSigstate, Serial.Pin.TXD);
createLed(pSigstate, Serial.Pin.CTS);
createLed(pSigstate, Serial.Pin.DCD);
createLed(pSigstate, Serial.Pin.DSR);
createLed(pSigstate, Serial.Pin.RNG);
CLabel led = createLed(parent, Serial.Pin.BREAK);
led.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
led.setLeftMargin(20);
led = createLed(parent, Serial.Pin.ERROR);
led.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
led.setRightMargin(2);
led.setLeftMargin(10);
}
示例15: 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);
}