public static float drawString( Graphics2D gr, String s, float left, float top, float right, float bottom, boolean startAtTop )
	{
		String[] lines = s.split( "\n" );
		FontMetrics metrics = gr.getFontMetrics();

		final float cushion = 4f;
		float fontHeight = metrics.getHeight();
		float totalHeight = (fontHeight + cushion);
		float paraBottom = top + (lines.length * totalHeight);
		float y = (startAtTop ? top + fontHeight : bottom);
		float cx = (left + right) * 0.5f;
		float width, x;
		int line;

		for (int i = 0; i < lines.length; i++)
		{
			// The current line to draw
			line = (startAtTop ? i : lines.length - i - 1);
			// The width of the line in pixels
			width = metrics.stringWidth( lines[line] );
			// The starting x centered in the bounds.
			x = cx - (width * 0.5f);
			// Draw the line
			gr.drawString( lines[line], x, y );
			// Increase/Decrease y based on whether it started at the top.
			y += (startAtTop ? totalHeight : -totalHeight);
		}

		// Return the bottom of the paragraph
		// based on whether it started at the top.
		return (startAtTop ? paraBottom : bottom);
	}