text areas, printstream, and "\n"
Hey all. I'm almost done with my notepad program - there's just two tiny problems.
1) I used this code to save my files:
It's working kind of, but for some reason even if I have multiple new lines in my text area when I save it, it outputs them all onto one straight line. This is probably because the text area doesn't log when I start a new line... that's my guess. How do I get around this?
Scanner tScan = new Scanner(area.getText());
output.print("\n" + tScan.nextLine());
2) Also - how do I edit the title in the titlebar of my JFileChoosers? I tried to send it as the second parameter, as I had seen done in code I looked up, but it didn't work.