gpt4 book ai didi

java - 如何设置JavaFX TextArea的高度和宽度?

转载 作者:行者123 更新时间:2023-12-02 00:27:58 28 4
gpt4 key购买 nike

TextArea txt = new TextArea();

我应该调用什么方法来设置这个TextArea的高度和宽度?

最佳答案

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

关于java - 如何设置JavaFX TextArea的高度和宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37458555/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com