This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am reading from a file , and appending to a TextArea/JTextArea. Right now, each line in the text area stretches on forever. Is there some property I can use to make my TextArea wrap, so that the line doesn't extend horizontally beyond the visible area?
I don't know of a way to do this without doing it in your program yourself after you have taken the information from the file, but before you add it to the textfield... This is going to be a pain, though...
It would be alot simpler to use a JTextArea and use the setLineWrap( true ) and setWrapStyleWord( true ) methods... if you can use Swing, of course...
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Joined: May 23, 2001
Thanks, I was looking for a method like setLineWrap(), which I already found. The problem now is when I read from a file, if the document is formatted, with fonts, and tables, a lot of junk gets displayed in the text area. Any idea how to tackle that?
Now this is a problem... If you are talking about fonts and tables in something like MS Word... they have a proprietory way of embedding this in the document, and it will look like garbage to you ( this is because they are not saving the document as text, they are saving it as binary ). If you are talking about fonts and tables in HTML, this is not as much of a problem, just use a JEditorPane instead of a JTextArea, since JEditorPane understands basic HTML...