2
我正在嘗試使用JavaFX 2.0
創建TextBox
。 我的來源如下:TextBox中的新行(JavaFX 2.0)
TextBox textBox = new TextBox();
textBox.setPrefSize(150, 600);
textBox.setText("Hello\n world!");
結果是:
我怎麼能創造TextBox
新的生產線?
我正在嘗試使用JavaFX 2.0
創建TextBox
。 我的來源如下:TextBox中的新行(JavaFX 2.0)
TextBox textBox = new TextBox();
textBox.setPrefSize(150, 600);
textBox.setText("Hello\n world!");
結果是:
我怎麼能創造TextBox
新的生產線?
創建多線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有一個'多行'和'行'屬性。 JavaFX 1.3沒有TextArea。