javafx 如何让ComboBox铺满GridPane的整列

2025-05-20 23:18:09
推荐回答(2个)
回答1:

试试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

回答2:

给有无边框 加 width 并且赋值