Re: How to add rows of text to JTextArea



znôrt wrote:
If you give some importance to portability (wich could be the case since you're using Java), this is better:

ta.append("row1" + System.getProperty("line.separator")) ;

No, not at all. line.separator identifies the operating system's line separator, not the line separator used inside of Java. Java always uses just '\n', except in I/O methods like like BufferedReader.readLine(), which are supposed to to the necessary conversion.


If you append System.getProperty("line.separator") you in fact make your application less portable, not more.

/Thomas


-- The comp.lang.java.gui FAQ: ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq .



Relevant Pages

  • Re: How to add rows of text to JTextArea
    ... Thomas Weidenfeller wrote: ... > Java always uses ... except in I/O methods like like ... > necessary conversion. ...
    (comp.lang.java.gui)
  • comp.lang.java.gui FAQ
    ... There are so many Java FAQs. ... My GUI freezes. ... More Swing ... This is the FAQ for the comp.lang.java.gui newsgroup. ...
    (comp.lang.java.gui)
  • comp.lang.java.gui FAQ
    ... This is the FAQ for the comp.lang.java.gui newsgroup. ... There are so many Java FAQs. ... AWT is Sun's first Java GUI toolkit. ... Unless you have to support an old VM, Swing is usual the better choice ...
    (comp.lang.java.gui)
  • Re: Weird behavior in logrotate
    ... Every time the Java prog wants to write ... > to the log file it calls a Java method that opens the file in append ... If you can actually make java open the file in append ... Imagine if the truncate happens between the java ...
    (comp.os.linux.development.system)
  • Software suggestions
    ... This may be a FAQ, but I can't find a working link to the FAQ for the group. ... I prefer a solver that's written in Java, but that's not critical; what's important is that my Java code can pass the original problem description to the solver, check intermediate solutions against criteria not part of the SCP, and add constraints on the fly. ... but this is definitely the lowest priority criterion. ...
    (comp.constraints)