首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >标记上的FXML HBox.hgrow属性由于枚举错误而失败。

标记上的FXML HBox.hgrow属性由于枚举错误而失败。
EN

Stack Overflow用户
提问于 2017-09-08 19:15:46
回答 1查看 564关注 0票数 0

我正在尝试将一些工作的JavaFX代码转换为FXML。我尝试了以下几种方法,但是我得到了一个错误:

java.lang.IllegalArgumentException:无枚举常数javafx.scene.layout.Priority.Always

代码语言:javascript
复制
<?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>

然后,我尝试了一种不同的方法,但我不明白为什么第一种,而第二种。我在这里看到了第一种方式的代码示例,有些东西发生了变化,代码样本太旧了,我是遗漏了一些重要的东西,还是完全不明白我在做什么?

代码语言:javascript
复制
<?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>
EN

回答 1

Stack Overflow用户

发布于 2017-09-08 19:21:41

上面的James_D知道了,原来我有一个错误。有时额外的眼睛会发现愚蠢。

变化

代码语言:javascript
复制
<Pane>
    <HBox.hgrow><Priority fx:value="ALWAYS" /></HBox.hgrow>
</Pane>

代码语言:javascript
复制
<Pane HBox.hgrow="ALWAYS"></Pane>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46123216

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档