本文整理匯總了Java中org.eclipse.draw2d.Label.setForegroundColor方法的典型用法代碼示例。如果您正苦於以下問題:Java Label.setForegroundColor方法的具體用法?Java Label.setForegroundColor怎麽用?Java Label.setForegroundColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.draw2d.Label
的用法示例。
在下文中一共展示了Label.setForegroundColor方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createFigure
import org.eclipse.draw2d.Label; //導入方法依賴的package包/類
@Override
protected IFigure createFigure() {
final LineLayout layout = new LineLayout();
layout.setHorizontal(true);
layout.setMajorAlignment(FlowLayout.ALIGN_TOPLEFT);
layout.setMinorAlignment(FlowLayout.ALIGN_BOTTOMRIGHT);
layout.setMinorSpacing(SPACING);
layout.setMargin(MARGIN);
FreeformLayer res = new FreeformLayer();
final Label toolTip = new Label();
toolTip.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
toolTip.setBackgroundColor(ColorConstants.tooltipBackground);
toolTip.setForegroundColor(ColorConstants.tooltipForeground);
toolTip.setText(getModel().getTimelineWindow().getProvider().getTextAt(getModel().getBranch()));
res.setToolTip(toolTip);
res.setLayoutManager(layout);
return res;
}
示例2: update
import org.eclipse.draw2d.Label; //導入方法依賴的package包/類
private void update() {
removeAll();
valid = model.isMatrix();
if(valid) {
Object[] array = (Object[]) model.getValues();
for(Object line : array) {
int len = Array.getLength(line);
for(int i = 0; i < len; i++) {
Object e = Array.get(line, i);
Label label = new Label(e.toString()); // TODO array deepToString
label.setForegroundColor(ColorConstants.black);
add(label);
}
}
}
getLayoutManager().layout(this);
repaint();
}
示例3: MethodWidget
import org.eclipse.draw2d.Label; //導入方法依賴的package包/類
MethodWidget(IMethod method) {
setLayoutManager(new FlowLayout());
button = new Button(shortSig(method));
button.setToolTip(new Label(longSig(method)));
button.setForegroundColor(ColorConstants.black);
FontManager.setFont(button, PandionJConstants.BUTTON_FONT_SIZE);
button.setEnabled(methodsEnabled);
add(button);
resultLabel = new Label();
resultLabel.setForegroundColor(ColorConstants.black);
add(resultLabel);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
invoke(model, method, resultLabel);
}
});
}
示例4: ReferenceFigure
import org.eclipse.draw2d.Label; //導入方法依賴的package包/類
public ReferenceFigure(IReferenceModel model) {
super(model, false);
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.horizontalSpacing = 3;
layout.verticalSpacing = 0;
setLayoutManager(layout);
label = new Label(model.getName());
label.setForegroundColor(ColorConstants.black);
FontManager.setFont(label, PandionJConstants.VAR_FONT_SIZE);
String tooltip = Utils.getTooltip(model);
Collection<String> tags = model.getTags();
if(!tags.isEmpty())
tooltip += "\ntags: " + String.join(", ", tags);
label.setToolTip(new Label(tooltip));
add(label);
refLabel = new ReferenceLabel(model);
add(refLabel);
layout.setConstraint(refLabel, new GridData(PandionJConstants.POSITION_WIDTH, PandionJConstants.POSITION_WIDTH));
}
示例5: createFigure
import org.eclipse.draw2d.Label; //導入方法依賴的package包/類
@Override
public IFigure createFigure(IObjectModel e) {
Label label = new Label();
label.setForegroundColor(PandionJConstants.Colors.OBJECT_HEADER_FONT);
FontManager.setFont(label, PandionJConstants.OBJECT_HEADER_FONT_SIZE);
IType type = e.getType();
if(type != null) {
IMethod method = type.getMethod("toString", new String[0]);
if(!method.exists()) {
label.setText(":" + type.getElementName());
return label;
}
}
invokeToString(e, label);
label.setToolTip(new Label("returned by toString()"));
e.getRuntimeModel().registerDisplayObserver((event) -> {
if(event.type == IRuntimeModel.Event.Type.STEP ||event.type == IRuntimeModel.Event.Type.EVALUATION) {
invokeToString(e, label);
// label.setText(e.getStringValue());
}
});
return label;
}
示例6: update
import org.eclipse.draw2d.Label; //導入方法依賴的package包/類
void update(int r, int g, int b) {
boolean valid =
r >= 0 && r <= 255 &&
g >= 0 && g <= 255 &&
b >= 0 && b <= 255;
colorFig.setOpaque(valid);
colorFig.setBackgroundColor(valid ? PandionJUI.getColor(r, g, b) : null);
colorFig.setBorder(new LineBorder(valid ? ColorConstants.black : PandionJConstants.Colors.ERROR));
if(valid)
colorFig.setToolTip(null);
else {
Label label = new Label("Invalid RGB values");
label.setForegroundColor(PandionJConstants.Colors.ERROR);
colorFig.setToolTip(label);
}
text.setText(r + ", " + g + ", " + b);
}
示例7: createFigure
import org.eclipse.draw2d.Label; //導入方法依賴的package包/類
@Override
public IFigure createFigure(IObjectModel e) {
Label label = new Label("\"" + e.getStringValue() + "\"");
FontManager.setFont(label, PandionJConstants.VALUE_FONT_SIZE);
label.setForegroundColor(ColorConstants.black);
return label;
}
示例8: createFigure
import org.eclipse.draw2d.Label; //導入方法依賴的package包/類
@Override
public IFigure createFigure(IObjectModel e) {
Label label = new Label("\"" + e.getStringValue() + "\"");
FontManager.setFont(label, PandionJConstants.VALUE_FONT_SIZE);
label.setForegroundColor(ColorConstants.black);
return label;
}
示例9: updateLook
import org.eclipse.draw2d.Label; //導入方法依賴的package包/類
private void updateLook(IStackFrameModel model, boolean termination) {
if(!invisible) {
if(model.isObsolete() || termination) {
setBackgroundColor(PandionJConstants.Colors.OBSOLETE);
setBorder(new LineBorder(model.exceptionOccurred() ? PandionJConstants.Colors.ERROR : ColorConstants.lightGray, 2, SWT.LINE_DASH));
}
else if(model.exceptionOccurred()) {
setBackgroundColor(PandionJConstants.Colors.INST_POINTER);
setBorder(new LineBorder(PandionJConstants.Colors.ERROR, PandionJConstants.STACKFRAME_LINE_WIDTH, SWT.LINE_DASH));
if(model.getExceptionType().equals(NullPointerException.class.getName()))
paintNullRefs();
Label labelExc = new Label(PandionJConstants.Messages.prettyException(model.getExceptionType()));
labelExc.setForegroundColor(PandionJConstants.Colors.ERROR);
setToolTip(labelExc);
}
else if(model.isExecutionFrame())
setBackgroundColor(PandionJConstants.Colors.INST_POINTER);
else
setBackgroundColor(PandionJConstants.Colors.VIEW_BACKGROUND);
}
layout.layout(this);
if(label != null && frame.getSourceFile() != null && frame.getLineNumber() != -1)
label.setToolTip(new Label(frame.getSourceFile().getName() + " (line " + frame.getLineNumber() +")"));
}
示例10: ValueExtensionFigure
import org.eclipse.draw2d.Label; //導入方法依賴的package包/類
public ValueExtensionFigure(IValueModel model, IFigure figure) {
super(model, false);
layout = new GridLayout(1, false);
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
layout.marginHeight = 0;
layout.marginWidth = 0;
setLayoutManager(layout);
Figure comp = new Figure();
GridLayout compLayout = new GridLayout(2,false);
compLayout.marginHeight = 0;
compLayout.marginWidth = 0;
compLayout.horizontalSpacing = 3;
compLayout.verticalSpacing = 0;
comp.setLayoutManager(compLayout);
String tooltip = Utils.getTooltip(model);
Label nameLabel = new Label(model.getName());
nameLabel.setForegroundColor(ColorConstants.black);
FontManager.setFont(nameLabel, PandionJConstants.VAR_FONT_SIZE);
nameLabel.setToolTip(new Label(tooltip));
comp.add(nameLabel);
comp.add(figure);
add(comp);
layout.setConstraint(comp, new GridData(SWT.RIGHT, SWT.DEFAULT, true, false));
}
示例11: Position
import org.eclipse.draw2d.Label; //導入方法依賴的package包/類
public Position(Integer index) {
int width = POSITION_WIDTH;
if(model.isDecimal())
width *= 2;
GridData layoutData = new GridData(width, POSITION_WIDTH+20);
arrayLayout.setConstraint(this, layoutData);
GridLayout layout = Constants.getOneColGridLayout();
setLayoutManager(layout);
if(index != null) {
IValueModel m = model.getElementModel(index);
valueLabel = new ValueLabel(m);
layout.setConstraint(valueLabel, new GridData(width, POSITION_WIDTH));
add(valueLabel);
}else {
Label emptyLabel = new Label("...");
FontManager.setFont(this, Constants.VALUE_FONT_SIZE);
IValueModel measure = model.getElementModel(model.getLength() - 1);
setSize(measure.isDecimal() || measure.isBoolean() ? Constants.POSITION_WIDTH*2 : Constants.POSITION_WIDTH, Constants.POSITION_WIDTH);
layout.setConstraint(emptyLabel, new GridData(width, POSITION_WIDTH));
add(emptyLabel);
}
indexLabel = new Label(index == null ? "..." : Integer.toString(index));
FontManager.setFont(indexLabel, INDEX_FONT_SIZE);
indexLabel.setLabelAlignment(SWT.CENTER);
indexLabel.setForegroundColor(ColorConstants.gray);
layout.setConstraint(indexLabel, layoutCenter);
add(indexLabel);
}
示例12: ColorFigure
import org.eclipse.draw2d.Label; //導入方法依賴的package包/類
ColorFigure() {
setLayoutManager(new GridLayout(2, false));
colorFig = new Figure();
colorFig.setSize(PandionJConstants.POSITION_WIDTH, PandionJConstants.POSITION_WIDTH);
add(colorFig);
text = new Label();
text.setForegroundColor(ColorConstants.black);
add(text);
}
示例13: PossibleStepFigure
import org.eclipse.draw2d.Label; //導入方法依賴的package包/類
/**
* Constructor.
*/
public PossibleStepFigure() {
final LineLayout layout = new LineLayout();
layout.setHorizontal(true);
layout.setMajorAlignment(FlowLayout.ALIGN_TOPLEFT);
layout.setMinorAlignment(FlowLayout.ALIGN_CENTER);
layout.setMinorSpacing(SPACING);
setLayoutManager(layout);
toolTip = new Label();
toolTip.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
toolTip.setBackgroundColor(ColorConstants.tooltipBackground);
toolTip.setForegroundColor(ColorConstants.tooltipForeground);
ellipse = createEllipse();
add(ellipse);
label = new Label();
if (withLabel) {
add(label);
hasLabel = true;
} else {
ellipse.setToolTip(toolTip);
hasLabel = false;
}
addMouseListener(new MouseListener.Stub() {
/**
* {@inheritDoc}
*
* @see org.eclipse.draw2d.MouseListener.Stub#mouseReleased(org.eclipse.draw2d.MouseEvent)
*/
@Override
public void mousePressed(MouseEvent me) {
if (me.button == 1) {
final EditPartViewer viewer = getViewer();
viewer.getSelectionManager().deselectAll();
viewer.getSelectionManager().appendSelection(PossibleStepEditPart.this);
}
}
});
}