简体   繁体   English

如何在javafx中进行控制以占据父对象的整个空间?

[英]How can i make a control to take whole space of parent in javafx?

I want to take a text box to take the whole space of a gridpane but I don't want to hardcode the size. 我想使用一个文本框来占用一个网格窗格的整个空间,但是我不想对大小进行硬编码。 I am swt programmer where I used to pass swt.fill,swt.fill to take the vertical and horizontal space. 我是swt程序员,以前我曾经通过swt.fill,swt.fill来获取垂直和水平空间。 And upon resizing the window the textbox used to expand vertically and horizontally. 调整窗口大小后,文本框用于垂直和水平扩展。 Can I achieve this using javafx. 我可以使用javafx来实现吗? Thanks in advance 提前致谢

To do that you have to set, the row span and the column span. 为此,必须设置行跨度和列跨度。 for example if you have 4 column in your gridpane and you want a textfield who have the size of the 4 column you need to set the column span to REMAINING. 例如,如果您的网格窗格中有4列,并且您希望文本字段的大小为4列,则需要将列跨度设置为REMAINING。 And your field will take all the column 您的字段将占用所有列

column span 列跨度

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM