2011-07-17 6 views
2

TextBoxJavaFX 2.0으로 만들려고합니다. 내 소스는 다음입니다 :TextBox (JavaFX 2.0)의 새 줄

TextBox textBox = new TextBox(); 
textBox.setPrefSize(150, 600); 
textBox.setText("Hello\n world!"); 

결과는 다음과 같습니다

enter image description here

어떻게 TextBox의 새로운 라인을 만들 수 있을까?

답변

4

다중 행 TextBox 만들기는 JavaFX 1.3 기능입니다. JavaFX 2.0에서는 TextArea를 사용해야합니다.

TextArea textArea = new TextArea(); 
textArea.setPrefRowCount(2);    
textArea.setText("Hello\nworld!"); 

JavaFX UI Controls 자습서에는 TextArea 컨트롤이 언급되어 있지 않습니다. 어쩌면 그들은 뭔가를 놓친 것일 수도 있습니다. 이 JavaFX 1.3 TextBox 튜토리얼에서 볼 수 있듯이 TextBox에는 'multiline'과 'lines'속성이 있습니다. JavaFX 1.3에는 TextArea가 없습니다.