1

アプリケーションでは、一方の FXML が他方の FXML の AnchorPane にロードされます。問題は、サイズ変更中に ListView の AnchorPane Constraints (正確には Bottom one) が機能しないことです。

ロードされるファイルのコード:

<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import java.net.*?>
<?import java.util.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>

<AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="-1.0" prefWidth="-1.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2">
  <children>
    <HBox cache="true" cacheHint="SPEED" fillHeight="true" minHeight="-1.0" prefHeight="-1.0" prefWidth="1280.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
      <children>
        <TabPane id="navPane" cache="true" cacheHint="SPEED" maxWidth="-1.0" minHeight="-1.0" minWidth="-1.0" prefHeight="-1.0" prefWidth="420.0" rotateGraphic="false" side="LEFT" tabClosingPolicy="UNAVAILABLE" tabMaxHeight="1.7976931348623157E308" tabMinHeight="30.0" HBox.hgrow="NEVER">
          <tabs>
            <Tab closable="true" text="Untitled Tab 1">
              <content>
                <AnchorPane id="AnchorPane" fx:id="homePane" cache="true" cacheHint="SPEED" maxHeight="-1.0" maxWidth="-1.0" minHeight="-1.0" minWidth="-1.0" prefHeight="-1.0" prefWidth="-1.0" style="-fx-background-color: red;">
                  <children>
                    <StackPane id="navPaneHeaderPane" cache="true" cacheHint="SPEED" prefHeight="35.0" prefWidth="200.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                      <children>
                        <AnchorPane id="navPaneHeaderPane" cache="true" cacheHint="SPEED" prefHeight="200.0" prefWidth="200.0" style="" />
                        <Label id="navPaneHeaderString" cache="true" cacheHint="SPEED" text="Label" StackPane.alignment="CENTER" />
                      </children>
                    </StackPane>
                    <TextField cache="true" cacheHint="SPEED" prefHeight="30.0" prefWidth="294.0" AnchorPane.leftAnchor="28.0" AnchorPane.rightAnchor="28.0" AnchorPane.topAnchor="55.0" />
                    <Separator cache="true" cacheHint="SPEED" prefWidth="200.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="100.0" />
                    <ListView fx:id="listView" cache="true" cacheHint="SPEED" minHeight="-1.0" minWidth="-1.0" pickOnBounds="true" prefHeight="-1.0" prefWidth="-1.0" AnchorPane.bottomAnchor="15.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="120.0" />
                  </children>
                </AnchorPane>
              </content>
            </Tab>
            <Tab text="Untitled Tab 2">
              <content>
                <AnchorPane id="Content" cache="true" cacheHint="SPEED" minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
              </content>
            </Tab>
          </tabs>
        </TabPane>
        <AnchorPane cache="true" cacheHint="SPEED" prefHeight="200.0" prefWidth="200.0" HBox.hgrow="ALWAYS">
          <children>
            <TableView cache="true" cacheHint="SPEED" prefHeight="700.0" prefWidth="860.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="0.0">
              <columns>
                <TableColumn prefWidth="75.0" text="Column X" />
                <TableColumn prefWidth="75.0" text="Column X" />
              </columns>
            </TableView>
          </children>
        </AnchorPane>
      </children>
      <stylesheets>
        <URL value="@../../../../skins/default.css" />
      </stylesheets>
    </HBox>
  </children>
</AnchorPane>

上記の FXML がロードされるファイルのコード:

<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import java.net.*?>
<?import java.util.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<?scenebuilder-preview-i18n-resource ../lang/ru_RU.properties?>

<AnchorPane id="AnchorPane" fx:id="mainStage" cache="true" cacheHint="SPEED" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="UI.PrimaryStageController">
  <children>
    <StackPane fx:id="toolbarStack" alignment="CENTER_LEFT" cache="true" cacheHint="SPEED" prefHeight="100.0" prefWidth="1280.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="100.0" AnchorPane.topAnchor="0.0">
      <children>
        <FlowPane fx:id="toolbarPane" cache="true" cacheHint="SPEED" maxHeight="-Infinity" minHeight="-Infinity" prefHeight="100.0" prefWidth="1280.0" style="">
          <children>
            <Button id="fileButton" fx:id="selectorButton" cache="true" cacheHint="SPEED" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#openSelector" prefHeight="100.0" prefWidth="100.0" text="%selectorButton" />
            <Button fx:id="fileButton" cache="true" cacheHint="SPEED" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#openFileMenu" prefHeight="100.0" prefWidth="100.0" text="%fileButton">
              <stylesheets>
                <URL value="@../../skins/default.css" />
              </stylesheets>
            </Button>
            <Button fx:id="toolsButton" cache="true" cacheHint="SPEED" mnemonicParsing="false" onAction="#openToolsMenu" prefHeight="100.0" prefWidth="100.0" text="Button" />
            <Button fx:id="helpButton" cache="true" cacheHint="SPEED" mnemonicParsing="false" onAction="#openHelpMenu" prefHeight="100.0" prefWidth="100.0" text="Button" />
          </children>
        </FlowPane>
      </children>
    </StackPane>
    <AnchorPane fx:id="contentPane" prefHeight="-1.0" prefWidth="-1.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="100.0" />
    <Button cache="true" cacheHint="SPEED" mnemonicParsing="false" onAction="#closeApp" prefHeight="100.0" prefWidth="100.0" text="%exitButton" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
  </children>
  <stylesheets>
    <URL value="@../../skins/default.css" />
  </stylesheets>
</AnchorPane>

最初の FXML は、 で AnchorPane にロードされfx:id = "contentPane"ます。fx:id = "listView"ウィンドウのサイズ変更中にListView のサイズが変更されないことがわかりません。何か案は?PS私はJavaFX 8を使用しています

4

0 に答える 0