我是 fxml 的新手,一开始它看起来很容易使用,但是当我给自己一个练习将 oracle 上的一个演示翻译成 fxml 时,我发现自己花了一整天的时间在 google 上。
但我仍然找不到这两个问题的答案:
btnAdd.setMaxHeight(Control.USE_PREF_SIZE);
btnAdd.setMaxWidth(Double.MAX_VALUE);
Run Code Online (Sandbox Code Playgroud)
如果有人知道我在哪里可以找到教程,请分享。
使用fx:constant:
<Button fx:id="btnAdd">
<maxHeight><Control fx:constant="USE_PREF_SIZE" /></maxHeight>
<maxWidth><Double fx:constant="MAX_VALUE" /></maxWidth>
</Button>
Run Code Online (Sandbox Code Playgroud)