javafx : javafx.scene.layout.AnchorPane cannot be cast to javafx.scene.layout.BorderPane

后端 未结 3 661
闹比i
闹比i 2021-01-15 07:55

hey guys i am knew to javafx and i am trying to cast a BorderPane to an anchronPane, meanwhile an error occured and i don t know what to do, i was following a tutorial so pl

3条回答
  •  情书的邮戳
    2021-01-15 08:47

    BorderPane extends Pane

    AnchorPane extends Pane

    They extend the same class but are different classes and generate different objects that can not be casted into each other.


    Practical example

    Lion extends BigCat

    Tiger extends BigCat

    How would you cast a Lion to a Tiger ?

提交回复
热议问题