Re: How to add rows of text to JTextArea



take a look at the insert method of the JTextArea
or if you want it at the very end the append method.
for your example it would be
JTextArea ta = JTextArea();
ta.appen("row1\n");
ta.appen("row2\n");
ta.appen("row3\n");

you may want to investigate the line-breaking further as I am not sure
this will work on all platforms.

but both the append and the insert methods seem to do the job you ask.


----
Daniel
http://www.daik.se

>Is a way to add text to a JTextArea as rows?
>
>For instance :
>
>row1
>row2
>row3
>
>?


.



Relevant Pages

  • Re: Text Area Colours
    ... is there a simple way to give a single String to the append method ... >of a JTextArea and have it come up in a different colour or even a different ... Canadian Mind Products, Roedy Green. ...
    (comp.lang.java.gui)
  • Re: How to add rows of text to JTextArea
    ... > take a look at the insert method of the JTextArea ... > or if you want it at the very end the append method. ... Gil ... Prev by Date: ...
    (comp.lang.java.gui)
  • Text Area Colours
    ... is there a simple way to give a single String to the append method ... of a JTextArea and have it come up in a different colour or even a different ... Prev by Date: ...
    (comp.lang.java.gui)
  • JTextArea n right alignment of text
    ... I have to align on the right side of the JTextArea some text, ... but i had no success. ... I have to use expressly JTextArea, 'couse it has append method. ...
    (comp.lang.java.help)
  • Re: Turning off line wrap in JTextPane
    ... >> The paragraph that I thought was relevant to your question reads as ... >> If your text is unstyled, consider using a JTextArea instead. ... Prev by Date: ...
    (comp.lang.java.gui)