lineWidth = 0;
lastWhitespaceIndex = -1;
// Append the current line
if ((i - 1) - start > 0) {
StringCharacterIterator line = new StringCharacterIterator(text, start, i, start);
GlyphVector glyphVector = font.createGlyphVector(FONT_RENDER_CONTEXT, line);
glyphVectors.add(glyphVector);
Rectangle2D textBounds = glyphVector.getLogicalBounds();
textWidth = (float)Math.max(textBounds.getWidth(), textWidth);
textHeight += textBounds.getHeight();
}
start = i + 1;
}
i++;
}
// Append the final line
if ((i - 1) - start > 0) {
StringCharacterIterator line = new StringCharacterIterator(text, start, i, start);
GlyphVector glyphVector = font.createGlyphVector(FONT_RENDER_CONTEXT, line);
glyphVectors.add(glyphVector);
Rectangle2D textBounds = glyphVector.getLogicalBounds();
textWidth = (float)Math.max(textBounds.getWidth(), textWidth);