有高并发 高访问量网站开发,品牌推广与传播,网站建设综合技术,企业网站免费源码JavaFX布局-SplitPane 常用属性orientationpaddingdividerPositionsdisable 实现方式Java实现fxml实现 一个拆分至少两个区域的容器支持水平、垂直布局可以拖动区域的大小初始化大小通过比例设置[0,1]
常用属性
orientation 排列方式#xff0c;Orientation.VERTICAL、Orien… JavaFX布局-SplitPane 常用属性orientationpaddingdividerPositionsdisable 实现方式Java实现fxml实现 一个拆分至少两个区域的容器支持水平、垂直布局可以拖动区域的大小初始化大小通过比例设置[0,1]
常用属性
orientation 排列方式Orientation.VERTICAL、Orientation.HORIZONTAL splitPane.setOrientation(Orientation.HORIZONTAL);padding 内边距可以单独设置上、下、左、右的内边距 splitPane.setPadding(new Insets(10, 10, 10, 10));dividerPositions 每个分割条的相对位置介于0.0和1.0之间 splitPane.setDividerPositions(0.33, 0.66);disable 是是可以拖动改变区域大小 splitPane.setDisable(true);实现方式
Java实现 public static SplitPane demo1() {SplitPane splitPane new SplitPane();// 布局方向splitPane.setOrientation(Orientation.VERTICAL);// 内边距splitPane.setPadding(new Insets(10, 10, 10, 10));// 区域比例splitPane.setDividerPositions(0.33, 0.66);// 是否可拖动splitPane.setDisable(true);FlowPane flowPane1 new FlowPane();flowPane1.setOrientation(Orientation.HORIZONTAL);flowPane1.setAlignment(Pos.CENTER);flowPane1.getChildren().add(new Circle(40, Color.RED));splitPane.getItems().add(flowPane1);FlowPane flowPane2 new FlowPane();flowPane2.setOrientation(Orientation.HORIZONTAL);flowPane2.setAlignment(Pos.CENTER);flowPane2.getChildren().add(new Circle(50, Color.GREEN));splitPane.getItems().add(flowPane2);FlowPane flowPane3 new FlowPane();flowPane3.setOrientation(Orientation.HORIZONTAL);flowPane3.setAlignment(Pos.CENTER);flowPane3.getChildren().add(new Circle(60, Color.BLUE));splitPane.getItems().add(flowPane3);return splitPane;}fxml实现 StackPane prefHeight400 prefWidth600 xmlnshttp://javafx.com/javafx/17.0.2-eaxmlns:fxhttp://javafx.com/fxml/1childrenSplitPane dividerPositions0.33, 0.66 prefHeight160.0 prefWidth200.0 disabletruepaddingInsets left10 top5 right10 bottom5//paddingitemsFlowPane minHeight0.0 minWidth0.0 prefHeight160.0 prefWidth100.0 orientationVERTICALalignmentCENTERCircle radius40 fillred//FlowPaneFlowPane minHeight0.0 minWidth0.0 prefHeight160.0 prefWidth100.0 orientationVERTICALalignmentCENTERCircle radius50 fillgreen//FlowPaneFlowPane minHeight0.0 minWidth0.0 prefHeight160.0 prefWidth100.0 orientationVERTICALalignmentCENTERCircle radius60 fillblue//FlowPane/items/SplitPane/children
/StackPane