I believe someone has already mentioned that JTextArea(or some similar class)
can do text wrap automatically.
String newStringBig = textArea1.getText();
StringTokenizer newTokn = new StringTokenizer(newStringBig,"\n");
while(newTokn.hasMoreTokens()) {
String newString= newTokn.nextToken("\n");
while (newString.length() > 24){
String line = newString.substring(0,newString.lastIndexOf(" ",24));
// do thing with the line
// ... ...
// rebuild the string
newString = newString.substring(line.length());
}
// use up the last part less than 24 char length
// ... ...
}