Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Lourdes Edwards   on Sep 22 In Java Category.

  
Question Answered By: Kiet Jainukul   on Sep 22

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
// ... ...
}

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on How do i tokenize a string Or get search suggestion and latest updates.


Tagged: