I'm creating an application using JavaFX and FXML.

I have a class:

class Card extends VBox
{
    private String title;
    private String description;
    /* and so on ... */
}

And I have an instance of class VBox

VBox box = FXMLLoader.load(getClass().getResource("styled_vbox.fxml");

And I have an instance of class Card

Card card;

I want to cast the box object to the class Card which extends VBox class so that i can assign the box object to the card object.

Is it possible to do it? If yes, how can i do it?

0 Answers