2011-01-23, 09:09 PM
a) Yes, I have checked that with a debugger. And even if I hadn't, the newlines display properly in the JTextArea. The line formatting is just fine - it just doesn't scroll.
b) Also, this line of code is 3 above the setText() that doesn't contain an explicit newline character:
The two lines between that and the setText() call are the out.write() and out.flush() calls that send the message. Also, if you don't know trim(), it just deletes all whitespace characters before and after the string (in case there are any extra newlines that I don't want to have, lest my formatting get ruined).
c) The one that doesn't have the explicit newline character is actually the one that works fine. It's the other one that fails to scroll properly.
I've been a bit busy with other stuff, but I'm going to try that caret thing now. I'll post (or just edit this) with results.
Edit: Finally got to testing it. A quick line of code seems to have fixed my bug. I figure it isn't the best or most elegant way to do it, but hey, it works. If someone has another suggestion that would address the actual source of the bug, though, I'm still interested in hearing it.
P.S. The line that made it all happy again:
b) Also, this line of code is 3 above the setText() that doesn't contain an explicit newline character:
Code:
s = s.trim() + "\n";c) The one that doesn't have the explicit newline character is actually the one that works fine. It's the other one that fails to scroll properly.
I've been a bit busy with other stuff, but I'm going to try that caret thing now. I'll post (or just edit this) with results.
Edit: Finally got to testing it. A quick line of code seems to have fixed my bug. I figure it isn't the best or most elegant way to do it, but hey, it works. If someone has another suggestion that would address the actual source of the bug, though, I'm still interested in hearing it.
P.S. The line that made it all happy again:
Code:
convo.setCaretPosition(convo.getText().length());
