/** * Gets the bounding rect for the string based on the font * * @param string * @return Rectangle */ public Rectangle2D getBounds(String string) { Rectangle2D rect; String[] rows = string.split("\n"); float height = rows.length * this.size; float width = this.longestString(rows) * this.size; rect = new Rectangle.Float(0, 0, width, height); return rect.getBounds2D(); }