本文介绍了JavaFX FXML与SceneBuilder中的工作方式不同(sceencast)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这种FXML,它可以在SceneBuilder Preview中正常运行,并且在NetBeans JavaFX示例应用程序中的行为完全不同(因此,没有任何其他东西可以破坏它的行为). (请参见电视广播)

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)

我需要2个TitledPanes来根据窗口自动调整大小(一半和一半)(因为它在SceneBuilder预览中可以正常工作).

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>

推荐答案

SceneBuilder预览版和NetBeans JavaFX示例应用程序正在使用不同版本的JavaFX. SceneBuilder可能正在使用2.1和NetBeans 2.0.2.通过升级计算机的Java版本或将新的jfxrt.jar版本导入您的类路径(即,导入到netbeans应用程序库中)来升级应用程序的版本.

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).

这篇关于JavaFX FXML与SceneBuilder中的工作方式不同(sceencast)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-09 18:47