忽略最小尺寸

时间:2016-07-12 13:56:03

标签: javafx

我正在使用Scenebuilder为我的应用程序创建UI。

我创建了简单的布局。

enter image description here

但即使在各地设置了最小尺寸之后,仍然可以将窗口缩小到此。

enter image description here

.fxml文件包含

    <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="400.0" minWidth="600.0" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
   <children>
      <MenuBar layoutY="2.0" minHeight="25.0" minWidth="600.0" prefHeight="25.0" prefWidth="600.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
        <menus>
          <Menu mnemonicParsing="false" text="File">
            <items>
              <MenuItem mnemonicParsing="false" text="Close" />
            </items>
          </Menu>
        </menus>
      </MenuBar>
      <SplitPane dividerPositions="0.85" layoutY="23.0" minHeight="377.0" minWidth="600.0" prefHeight="377.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="23.0">
        <items>
          <AnchorPane minHeight="377.0" minWidth="505.0" prefHeight="377.0" prefWidth="505.0">
               <children>
                  <TextFlow minHeight="377.0" minWidth="505.0" prefHeight="377.0" prefWidth="505.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
               </children>
            </AnchorPane>
          <AnchorPane minHeight="200.0" minWidth="87.0" prefHeight="200.0" prefWidth="87.0">
               <children>
                  <Pane minHeight="200.0" minWidth="87.0" prefHeight="200.0" prefWidth="87.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
               </children>
            </AnchorPane>
        </items>
      </SplitPane>
   </children>
</AnchorPane>

我试图通过不同的元素设置最小尺寸。或者将其设置为与pref_size匹配。但没有结果。

如何设置一个窗格(或其他元素)不能小于某个数字?

0 个答案:

没有答案