Pasting on a JTextField
Hello,
Here is my problem.
I am copying a fragment of text(~100 characters) from a file opened with any editor and I paste it on a JTextField. The text that I copied is about 4-5 lines and each line is seperated with a CRLF bicharacter( 0x0D,0x0A ). The problem is thta when I paste the text on the JTextField(or a JTextArea) the CRLFs are replaced with a linefeed character (0x20). Is there any way to prevent this replace?
Thanks in advance.
[468 byte] By [
bankerera] at [2007-10-3 8:46:41]

> CRLFs are replaced with a linefeed character (0x20).
x20 is a space character so this makes sense for a JTextField
for a JTextArea the Document only store a "\n" in the Document to represent the newline string. If you use the textArea.write(...) method the "\r\n" is inserted into the file correctly.
You could try using a JTextPane. Again the Document only stores the "\n" to represent the newline buy then try using:
textPane.getText();
textPane.getDocument().getText()
One method will return the text with just the "\n" character, the other will return the "\r\n" character.