窗口大小增加时按钮重叠-javafx-fxml

窗口大小增加时按钮重叠-javafx-fxml,javafx,fxml,scenebuilder,Javafx,Fxml,Scenebuilder,我对纽扣的尺寸有意见。当我增大窗户的尺寸时, 按钮相互重叠。我已经尝试了很多方法来避免这种情况,例如用锚烷将每个按钮包裹起来,但都没有成功 下面是用于按钮“devis”的fxml代码,例如: <AnchorPane layoutX="5.0" layoutY="71.0" maxHeight="61.25" prefHeight="58.0" prefWidth="206.0" AnchorPane.bottomAnchor="116.0" AnchorPane.leftAnchor="5

我对纽扣的尺寸有意见。当我增大窗户的尺寸时, 按钮相互重叠。我已经尝试了很多方法来避免这种情况,例如用锚烷将每个按钮包裹起来,但都没有成功

下面是用于按钮“devis”的fxml代码,例如:

<AnchorPane layoutX="5.0" layoutY="71.0" maxHeight="61.25" prefHeight="58.0" prefWidth="206.0" AnchorPane.bottomAnchor="116.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="71.0">
  <children>
      <Button fx:id="devis" maxHeight="65.0" mnemonicParsing="false" onAction="#selectViewDevis" prefHeight="65.0" prefWidth="206.0" text="Devis" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
         <font>
            <Font size="14.0" />
         </font>
      </Button>
   </children>
</AnchorPane>

谢谢你的帮助

Aaron

尝试使用



您的代码中只有一个按钮。另外,当用户增加窗口大小时,您实际希望发生什么?我的代码有更多的按钮。我想把它简短一点,我不想太难,但是如果你只提供一个按钮的代码,你怎么可能认为你可以提供显示按钮重叠的代码呢?从那件事上谁能告诉你你做错了什么?创建一个:您应该能够使用(可能)两个按钮来完成这项工作,并提供一个完整的、可执行的示例来重现问题(但显然,不是您的整个项目)。解释它在做什么,以及你实际上希望它如何表现。首先确保您已经阅读了基本教程和布局文档。
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>


<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1">
   <children>
      <SplitPane dividerPositions="0.35451505016722407" layoutX="189.0" layoutY="167.0" prefHeight="160.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
        <items>
          <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
               <children>
                  <VBox layoutX="24.0" layoutY="14.0" minWidth="200.0" prefHeight="200.0" prefWidth="100.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                     <children>
                        <StackPane prefHeight="150.0" prefWidth="200.0">
                           <children>
                              <ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
                           </children>
                        </StackPane>
                        <Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="Button" />
                        <Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="Button" />
                        <Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="Button" />
                     </children>
                  </VBox>
               </children>
            </AnchorPane>
          <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" />
        </items>
      </SplitPane>
   </children>
</AnchorPane>