org.eclipse.draw2d.TextUtilities Java Examples

The following examples show how to use org.eclipse.draw2d.TextUtilities. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ROIFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void paintFigure(Graphics graphics) {
	if(roiInfoProvider!=null && roiDataBounds!=null){
		String text = roiInfoProvider.getROIInfo(roiDataBounds.x, roiDataBounds.y, 
				roiDataBounds.width, roiDataBounds.height);
		Dimension size = TextUtilities.INSTANCE.getTextExtents(text, getFont());
		graphics.pushState();
		graphics.translate(getLocation());
		graphics.fillRectangle(roiGeoBounds.x, roiGeoBounds.y - size.height, size.width, size.height);
		graphics.drawText(text, roiGeoBounds.x, roiGeoBounds.y - size.height);
		graphics.popState();
	}
	super.paintFigure(graphics);
	
}
 
Example #2
Source File: AbstractScale.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
protected void internalSetFormatPattern(String formatPattern) {
	if (Objects.equals(this.formatPattern, formatPattern))
		return;
	this.formatPattern = formatPattern;
	if (formatPattern != null && isDateEnabled())
		formatPatternSize = TextUtilities.INSTANCE.getTextExtents(formatPattern, getFont()).width;
}
 
Example #3
Source File: SyntaxColoringLabel.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public FlowUtilitiesEx getFlowUtilities() {
	if (flowUtilities == null) {
		flowUtilities = new FlowUtilitiesEx(MapModeUtil.getMapMode(this)) {
			@Override
			protected TextUtilities getTextUtilities() {
				if (textUtilities == null) {
					textUtilities = new StyleTextUtilities(MapModeUtil.getMapMode(StyledTextFlow.this));
				}
				return textUtilities;
			}
		};
	}
	return flowUtilities;
}
 
Example #4
Source File: Draw2DGraphics.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public Point textExtent ( final String string )
{
    final Dimension result = TextUtilities.INSTANCE.getTextExtents ( string, this.g.getFont () );
    return new Point ( result.width, result.height );
}