Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何设置JavaFXTextArea的高度和宽度?_Java_Javafx 8 - Fatal编程技术网

如何设置JavaFXTextArea的高度和宽度?

如何设置JavaFXTextArea的高度和宽度?,java,javafx-8,Java,Javafx 8,我调用什么方法来设置此文本区域的高度和宽度?setPrefColumnCount()和setPrefRowCount()工作得更好: TextArea textArea = new TextArea(); //making a TexrArea object double height = 400; //making a variable called height with a value 400 double width = 300; //making a variable called

我调用什么方法来设置此
文本区域的高度和宽度?

setPrefColumnCount()和setPrefRowCount()工作得更好:

TextArea textArea = new TextArea(); //making a TexrArea object
double height = 400; //making a variable called height with a value 400
double width = 300;  //making a variable called height with a value 300

//You can use these methods
textArea.setPrefHeight(height);  //sets height of the TextArea to 400 pixels 
textArea.setPrefWidth(width);    //sets width of the TextArea to 300 pixels

setPrefColumnCount()
setPrefRowCount()
应该为您做这件事。谢谢你的建议,请考虑添加一些细节和解释来支持你的答案,以帮助他人。
TextArea textArea = new TextArea(); //making a TexrArea object
double height = 400; //making a variable called height with a value 400
double width = 300;  //making a variable called height with a value 300

//You can use these methods
textArea.setPrefHeight(height);  //sets height of the TextArea to 400 pixels 
textArea.setPrefWidth(width);    //sets width of the TextArea to 300 pixels
TextArea textArea = new TextArea();
double prefWidth = 1.0
double prefHeight = 1.0
textArea.setPrefSize(prefWidth, prefHeight);