rendered paste bodyvoid drawWrappedString( Font f, String text, int x, int y, int maxWidth ) {
Vector lines = new Vector();
while(text.length() > 0) {
String aLine = text;
while(f.getWidth(aLine) > maxWidth) {
int rSpace = aLine.lastIndexOf(" ");
if( rSpace == -1 ) {
break;
}
aLine = aLine.substring( 0, rSpace );
}
lines.add( aLine );
text = text.substring( aLine.length() ).trim();
}
int numLines = lines.size();
int startY = y ;
int height = f.getHeight(" ");
for( int i = 0; i < numLines; i++ ) {
String line = (String)lines.elementAt( i );
float width = f.getWidth(line);
float thisLineX = x;
int yoff = (f instanceof AngelCodeFont) ? ((AngelCodeFont)f).getYOffset(line) : 0;
f.drawString(thisLineX,startY + (i * height-yoff),line);
}
}