我正在尝试将一些工作的JavaFX代码转换为FXML。我尝试了以下几种方法,但是我得到了一个错误:
java.lang.IllegalArgumentException:无枚举常数javafx.scene.layout.Priority.Always
<?import javafx.scene.layout.VBox ?>
<?import javafx.scene.layout.HBox ?>
<?import javafx.scene.layout.Pane ?>
<?import javafx.scene.layout.Priority ?>
<VBox xmlns:fx="http://javafx.com/fxml" >
<HBox>
<Button text="License" />
<Button text="Credits" />
<Pane HBox.hgrow="Always"></Pane>
<Button text="Exit" />
</HBox>
</VBox>然后,我尝试了一种不同的方法,但我不明白为什么第一种,而第二种。我在这里看到了第一种方式的代码示例,有些东西发生了变化,代码样本太旧了,我是遗漏了一些重要的东西,还是完全不明白我在做什么?
<?import javafx.scene.layout.VBox ?>
<?import javafx.scene.layout.HBox ?>
<?import javafx.scene.layout.Pane ?>
<?import javafx.scene.layout.Priority ?>
<VBox xmlns:fx="http://javafx.com/fxml" >
<HBox>
<Button text="License" />
<Button text="Credits" />
<Pane>
<HBox.hgrow><Priority fx:value="ALWAYS" /></HBox.hgrow>
</Pane>
<Button text="Exit" />
</HBox>
</VBox>发布于 2017-09-08 19:21:41
上面的James_D知道了,原来我有一个错误。有时额外的眼睛会发现愚蠢。
变化
<Pane>
<HBox.hgrow><Priority fx:value="ALWAYS" /></HBox.hgrow>
</Pane>至
<Pane HBox.hgrow="ALWAYS"></Pane>https://stackoverflow.com/questions/46123216
复制相似问题