我正在尝试将一些有效的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>
答案 0 :(得分:1)
James_D上面得到了它,结果发现我有一个错字。有时额外的眼睛会愚蠢。
更改
git reflog expire --expire=now --all && git gc --prune=now --aggressive
要
<Pane>
<HBox.hgrow><Priority fx:value="ALWAYS" /></HBox.hgrow>
</Pane>