
javafx 如何让ComboBox铺满GridPane的整列 20
例如下图:现在“位置”和“有无边框”我是放在一个GridPane中,我希望“有无边框”对应的的ComboBox和上面的“位置”对应的TextField一样充满整列...
例如下图:现在“位置”和“有无边框”我是放在一个GridPane中,我希望“有无边框”对应的的ComboBox和上面的“位置”对应的TextField一样充满整列
展开
2个回答
展开全部
试试GridPane的这个方法:
public static void setHgrow(Node child,
Priority value)
Sets the horizontal grow priority for the child when contained by a gridpane.
If set, the gridpane will use the priority to allocate the child additional
horizontal space if the gridpane is resized larger than it's preferred width.
Setting the value to null will remove the constraint.
Parameters:
child - the child of a gridpane
value - the horizontal grow priority for the child
public static void setHgrow(Node child,
Priority value)
Sets the horizontal grow priority for the child when contained by a gridpane.
If set, the gridpane will use the priority to allocate the child additional
horizontal space if the gridpane is resized larger than it's preferred width.
Setting the value to null will remove the constraint.
Parameters:
child - the child of a gridpane
value - the horizontal grow priority for the child
追问
这个方法我尝试过了,用在TextFiled上面有用,但是用在ComboBox上面是无效的。。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询