I've got this FXML that is working perfectly in SceneBuilder Preview and acts completely different on NetBeans JavaFX Sample Application (so there is nothing extra that could break it's behaviour). (see sceencast)

I need that 2 TitledPanes to autoresize (half and half) according with the Window (as it works in the SceneBuilder Preview).

<AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefWidth="798.0" xmlns:fx="http://javafx.com/fxml" fx:controller="javafxapplication2.Sample">
  <children>
    <VBox id="vBox1" prefWidth="770.0" spacing="25.0" AnchorPane.bottomAnchor="25.0" AnchorPane.leftAnchor="25.0" AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="25.0">
      <children>
        <TitledPane id="titledPane1" fx:id="test" prefWidth="748.0" text="Admin" VBox.vgrow="ALWAYS">
          <content>
            <AnchorPane id="Content" minHeight="0.0" minWidth="0.0">
              <children>
                <TableView id="tableView1" prefWidth="718.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="14.0" />
              </children>
            </AnchorPane>
          </content>
        </TitledPane>
        <TitledPane id="titledPane2" prefWidth="748.0" text="Resellers" VBox.vgrow="ALWAYS">
          <content>
            <AnchorPane id="Content" minWidth="0.0" prefWidth="744.0">
              <children>
                <TableView id="tableView2" prefWidth="200.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="14.0" />
              </children>
            </AnchorPane>
          </content>
        </TitledPane>
      </children>
    </VBox>
  </children>
</AnchorPane>
有帮助吗?

解决方案

The SceneBuilder Preview and NetBeans JavaFX Sample Application are using different versions of JavaFX. Probably the SceneBuilder is using 2.1 and NetBeans 2.0.2. Upgrade the version of the app, either by upgrading the Java version of your machine or importing the new jfxrt.jar version to your classpath (ie. into netbeans app libraries).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top