我希望我的Javafx组件(如标签,单独包装在VBox中的TextFields)保留在窗口的中心,即使它已调整大小.看到attatched Images.目前,这些组件包含在anchorPane中.FXML文件代码如下.请告诉我如何做到这一点.谢谢.
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="650.0" minWidth="850.0" prefHeight="650.0" prefWidth="850.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<HBox layoutY="-1.0" minWidth="500.0" prefHeight="653.0" prefWidth="850.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<MenuBar layoutY="-1.0" minWidth="500.0" prefHeight="30.0" prefWidth="850.0" HBox.hgrow="ALWAYS">
<menus>
<Menu mnemonicParsing="false" text="Account">
<items>
<MenuItem fx:id="menuItemCreate" mnemonicParsing="false" text="Create" />
<MenuItem fx:id="menuItemUpdate" mnemonicParsing="false" text="Update" />
<MenuItem fx:id="menuItemDelete" mnemonicParsing="false" text="Delete" />
<MenuItem fx:id="menuItemLedger" mnemonicParsing="false" text="Ledger" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="In Stock">
<items>
<MenuItem fx:id="menuItemAddItem" mnemonicParsing="false" text="Add items" …Run Code Online (Sandbox Code Playgroud)