Vaadin7, TextField : cannot display text in several lines

Hi all,

Using Vaadin 7.1.3, i do not know how to display some text in several lines inside a TextField.
I tried to add “\r\n” or “/r/n” at the end of each line, but the text is still displayed in one single line.


BufferedReader br = null;
try {
	String sCurrentLine;
	br = new BufferedReader(new FileReader(file));
	while ((sCurrentLine = br.readLine()) != null) {
		contentOfFile = contentOfFile + "\r\n" + sCurrentLine;
	}
	System.out.println(contentOfFile);
} 
catch (IOException e) {...} 
finally {
	try {if (br != null)br.close();} 
	catch (IOException ex) {...}
}
TextField txtOutputContentOfFile = new TextField();
txtOutputContentOfFile.setWidth("95%");//ie6
txtOutputContentOfFile.setHeight("300px");
txtOutputContentOfFile.setValue(contentOfFile);

=> Inside the textfield, the text appears in one line instead of 50 lines

Any idea ?

Eric

Textfield is made for single-line Texts and as of Vaadin 7 changes were made so that it can’t be used as multiline text input field like it was still possible in Vaadin 6. Use TextArea instead.

TextArea works fine, thank you Marius