Here's the code.  Just plant this in your MailerBean class and call it when
running setText().

 protected String wrapText(String text)
 {
     int width = 68;
     StringTokenizer parser = new StringTokenizer(text, " ", true);
     StringBuffer buf = new StringBuffer();
     String token;
     while (parser.hasMoreTokens())
     {
         token = parser.nextToken();
         if ((buf.length() + token.length()) % width < token.length())
         {
             buf.append("\n");
             buf.append(token.trim());
         }
         else
         {
             buf.append(token);
         }
     }

     return buf.toString();
 }

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <[EMAIL PROTECTED]>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Microsoft's Law of Software Engineering: 
Don't worry if it doesn't work right. 
If everything did, we'd be out of a job.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to