/** * Adds a line of text that will be displayed using the specified font. * * @param text the text. * @param font the font. * @param paint the paint. */ public void addLine(final String text, final Font font, final Paint paint) { addLine(new TextLine(text, font, paint)); }
/** * Returns the width and height of the text block. * * @param g2 the graphics device. * * @return The width and height. */ public Size2D calculateDimensions(final Graphics2D g2) { double width = 0.0; double height = 0.0; final Iterator iterator = this.lines.iterator(); while (iterator.hasNext()) { final TextLine line = (TextLine) iterator.next(); final Size2D dimension = line.calculateDimensions(g2); width = Math.max(width, dimension.getWidth()); height = height + dimension.getHeight(); } return new Size2D(width, height); }
final TextFragment lastFragment = lastLine.getLastTextFragment(); final String oldStr = lastFragment.getText(); String newStr = "..."; lastLine.removeFragment(lastFragment); final TextFragment newFragment = new TextFragment(newStr, lastFragment.getFont(), lastFragment.getPaint()); lastLine.addFragment(newFragment);
if (s != null) { if (edge == RectangleEdge.TOP || edge == RectangleEdge.BOTTOM) { TextLine line = new TextLine(s, this.sublabelFont, this.sublabelPaint); label.addLine(line); TextLine line = label.getLastLine(); if (line != null) { line.addFragment(new TextFragment(" " + s, this.sublabelFont, this.sublabelPaint));
while (iterator.hasNext()) { TextLine line = (TextLine) iterator.next(); Size2D dimension = line.calculateDimensions(g2); float lineOffset = 0.0f; if (this.lineAlignment == HorizontalAlignment.CENTER) { lineOffset = (float) (d.getWidth() - dimension.getWidth()); line.draw( g2, anchorX + offsets[0] + lineOffset, anchorY + offsets[1] + yCursor, TextAnchor.TOP_LEFT, rotateX, rotateY, angle
TextAnchor anchor, float rotateX, float rotateY, double angle) { Size2D dim = calculateDimensions(g2); float xAdj = 0.0f; if (anchor.isHorizontalCenter()) { final float yOffset = calculateBaselineOffset(g2, anchor); final Iterator iterator = this.fragments.iterator(); while (iterator.hasNext()) {
final float yOffset = calculateBaselineOffset(g2, anchor); final Iterator iterator = this.fragments.iterator(); while (iterator.hasNext()) {
TextFragment lastFragment = lastLine.getLastTextFragment(); String oldStr = lastFragment.getText(); String newStr = "..."; lastLine.removeFragment(lastFragment); TextFragment newFragment = new TextFragment(newStr, lastFragment.getFont(), lastFragment.getPaint()); lastLine.addFragment(newFragment);
while (iterator.hasNext()) { TextLine line = (TextLine) iterator.next(); Size2D dimension = line.calculateDimensions(g2); float lineOffset = 0.0f; if (this.lineAlignment == HorizontalAlignment.CENTER) { lineOffset = (float) (d.getWidth() - dimension.getWidth()); line.draw( g2, anchorX + offsets[0] + lineOffset, anchorY + offsets[1] + yCursor, TextAnchor.TOP_LEFT, rotateX, rotateY, angle
final float yOffset = calculateBaselineOffset(g2, anchor); final Iterator iterator = this.fragments.iterator(); while (iterator.hasNext()) {
final TextFragment lastFragment = lastLine.getLastTextFragment(); final String oldStr = lastFragment.getText(); String newStr = "..."; lastLine.removeFragment(lastFragment); final TextFragment newFragment = new TextFragment(newStr, lastFragment.getFont(), lastFragment.getPaint()); lastLine.addFragment(newFragment);
while (iterator.hasNext()) { TextLine line = (TextLine) iterator.next(); Size2D dimension = line.calculateDimensions(g2); float lineOffset = 0.0f; if (this.lineAlignment == HorizontalAlignment.CENTER) { lineOffset = (float) (d.getWidth() - dimension.getWidth()); line.draw( g2, anchorX + offsets[0] + lineOffset, anchorY + offsets[1] + yCursor, TextAnchor.TOP_LEFT, rotateX, rotateY, angle
/** * Adds a line of text that will be displayed using the specified font. * * @param text the text. * @param font the font. * @param paint the paint. */ public void addLine(final String text, final Font font, final Paint paint) { addLine(new TextLine(text, font, paint)); }
/** * Returns the width and height of the text block. * * @param g2 the graphics device. * * @return The width and height. */ public Size2D calculateDimensions(final Graphics2D g2) { double width = 0.0; double height = 0.0; final Iterator iterator = this.lines.iterator(); while (iterator.hasNext()) { final TextLine line = (TextLine) iterator.next(); final Size2D dimension = line.calculateDimensions(g2); width = Math.max(width, dimension.getWidth()); height = height + dimension.getHeight(); } return new Size2D(width, height); }
/** * Adds a line of text that will be displayed using the specified font. * * @param text the text. * @param font the font. * @param paint the paint. */ public void addLine(final String text, final Font font, final Paint paint) { addLine(new TextLine(text, font, paint)); }
/** * Returns the width and height of the text block. * * @param g2 the graphics device. * * @return The width and height. */ public Size2D calculateDimensions(final Graphics2D g2) { double width = 0.0; double height = 0.0; final Iterator iterator = this.lines.iterator(); while (iterator.hasNext()) { final TextLine line = (TextLine) iterator.next(); final Size2D dimension = line.calculateDimensions(g2); width = Math.max(width, dimension.getWidth()); height = height + dimension.getHeight(); } return new Size2D(width, height); }