How to define ButtonBar inside of FXML file and adjust buttons order?

1,177 views
Skip to first unread message

Maxim Dobryakov

unread,
Aug 2, 2014, 10:45:55 AM8/2/14
to control...@googlegroups.com
Hi All,

Is it possible to define ButtonBar inside of FXML file and adjust buttons order?

The following snippet:

<ButtonBar>
    <buttons>
        <Button mnemonicParsing="false" onAction="#testConnectionHandler" text="Test Connection" ButtonBar.type="RIGHT" />
        <Button defaultButton="true" minWidth="80.0" mnemonicParsing="false" onAction="#okHandler" text="OK" />
        <Button cancelButton="true" minWidth="80.0" mnemonicParsing="false" onAction="#cancelHandler" text="Cancel" />
    </buttons>
</ButtonBar>

throw exception:

Caused by: com.sun.javafx.fxml.PropertyNotFoundException: Static property "type" does not exist or is read-only.
    at com.sun.javafx.fxml.BeanAdapter.put(BeanAdapter.java:595)
    at javafx.fxml.FXMLLoader$Element.applyProperty(FXMLLoader.java:508)
    at javafx.fxml.FXMLLoader$Element.processValue(FXMLLoader.java:357)
    at javafx.fxml.FXMLLoader$Element.processPropertyAttribute(FXMLLoader.java:319)
    at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:769)
    at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2839)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2532)
    ... 16 more

Thanks

Adrien Walesch

unread,
May 22, 2015, 7:37:45 AM5/22/15
to control...@googlegroups.com
Hello,

I know this post is old, but it was the only question on the subject. Just in case other come around with the same problem, here is what I found in a github project : https://github.com/ccavanaugh/jgnash/blob/master/jgnash-fx/src/main/resources/jgnash/uifx/views/register/SplitTransactionDialog.fxml.

As you can see, he is using the ButtonBar.ButtonType="<the_button_type" property, where <the_button_type> is one of those Enum : ButtonBar.ButtonType (JavaFX)
In you snippet, you should have :
<Button mnemonicParsing="false" onAction="#testConnectionHandler" text="Test Connection" ButtonBar.ButtonType="RIGHT" />
Reply all
Reply to author
Forward
0 new messages