我想将目录中的图像加载到流盘中。流动盘在滚动盘内部。一切都很好,但是当最大化应用程序时,流盘不会使用其父级(即滚动盘)自动调整大小。我希望流窗格使用滚动盘自动调整自身大小。
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainController">
<children>
<MenuBar>
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
<MenuItem mnemonicParsing="false" text="Close" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Edit">
<items>
<MenuItem mnemonicParsing="false" text="Delete" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" text="About" />
</items>
</Menu>
</menus>
</MenuBar>
<VBox prefHeight="70.0" prefWidth="900.0">
<children>
<AnchorPane prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: green;">
<children>
<Button id="importBtn" layoutX="824.0" layoutY="12.0" mnemonicParsing="false" onMouseClicked="#importImages" prefHeight="43.0" prefWidth="62.0" text="Import" textFill="#e42d2d" AnchorPane.rightAnchor="14.0" />
</children>
</AnchorPane>
</children>
</VBox>
<SplitPane dividerPositions="0.2828507795100223, 0.8028953229398663" prefHeight="436.0" prefWidth="900.0" VBox.vgrow="ALWAYS">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" />
<ScrollPane pannable="true" prefHeight="737.0" prefWidth="506.0">
<content>
<FlowPane fx:id="flowPane" FlowPane. hgap="20.0" prefHeight="669.0" prefWidth="459.0" style="-fx-background-color: yellow;" vgap="20.0">
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding></FlowPane>
</content>
</ScrollPane>
<AnchorPane maxWidth="200.0" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" />
</items>
</SplitPane>
<HBox prefHeight="32.0" prefWidth="900.0" />
</children>
</VBox>