edvin / tornadofx-guide

TornadoFX Guide
133 stars 67 forks source link

Drawer tag in fxml problem #91

Closed ysdxz207 closed 6 years ago

ysdxz207 commented 6 years ago

When I use Drawer tag in fxml,idea tell me "Unable to instantiate". Please help me.


<VBox>
                    <padding>
                        <Insets top="4"/>
                    </padding>
                    <Drawer>
                        <items>
                            <TextArea fx:id="textAreaValue" minHeight="444" minWidth="610" prefWidth="610"/>
                        </items>
                    </Drawer>
                </VBox>

_20181121173420

edvin commented 6 years ago

The Drawer control was not made with FXML support in mind. If you look at the code you'll see that it requires some constructor parameters. It might be possible to instantiate with constructor parameters in FXML, but I don't use FXML and have no interest in it so I'm not sure how that would be done.

I can't see a single good reason to use FXML in 2018 so I would recommend you reconsider this approach and go for the type safe builders instead. You won't regret it :)

ysdxz207 commented 6 years ago

I will adopt your suggestion, thank you very much.