Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Line Break in a Applet TextArea

Status
Not open for further replies.

vvicin01

Programmer
Aug 14, 2001
21
0
0
US
I am passing information from several textfields to a text area in a applet. The problem is, how to I add a return (or line break) between each fields. I have tried \n and \r between the two but it does not help:
txtResponse.setText("Data:"
+ TexTField1.getText()+
+ TexTField2.getText() );

Please assist.

Thanks
 
are you including the \n and \r in double quotes like the rest of the string?
 
Yes. I've tried + TexTField1.getText()+"\n"
+ TexTField2.getText() );

Also "\r". It doesn't give me a return.
 
String newline = System.getProperty("line.separator");
TexTField1.getText()+newline;
This may work.(I copy from a book.)
 
failing that, try it with HTML tags (this works at 1.2.2 and above for other JComponents such as labels and buttons- although I am not sure if you are using swing or awt?).

<html> text <br> more text </html>
bruce21.jpg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top