Working with JTextArea
I am writing a simple text editor, I am having problems with a JTextArea.
I can enter text and everything is fine, but when I save it into a text file the line breaks are not recognized. If i open that file with notepad it simply shows a box in place of the line break. Also when I load that text file into the JTextArea the boxes are not there, and the line breaks are just not present.
My second problem is printing. I found a way to print text to the printer, using a print stream, but when I print anything from my TextArea each line is tabbed over.
Is there any way I can fix that, or is there a different way to print text to the default printer?
Thanks in advance
Take a look at the API documentation for JTextArea - you'll see a reference to the "DefaultEditorKit" class of javax.swing.text "for a discussion on how newlines are handled."
There is a tutorial on text components which you can find at: