设置BorderPane组件大小

时间:2013-08-26 10:23:16

标签: javafx-2 javafx javafx-8

我想设置BorderPane的Center,Top,Left,Right和Bottom组件的大小。

enter image description here

到目前为止,我发现了这个:

BorderPane() mainpane = new BorderPane();
mainPane.getBottom().prefWidth(sizeX);

例如,我如何获得BorderPane左侧的大小并设置大小?

1 个答案:

答案 0 :(得分:2)

BorderPane的“左”是你设置它的任何东西,它的大小就是你设置它的大小。

示例:

BorderPane mainpane = new BorderPane();
StackPane left = new StackPane();
left.setPrefWidth(100);
mainPane.setLeft(left);