Say I have an HBox like this:
val texts = new HBox {
content = Seq(new TextArea, new TextArea)
}
Now I'd like to get TextArea
s' text values in a collection. How can I get to these TextArea
s? texts.content
is an ObservableList[javafx.scene.Node]
, not ObservableList[TextArea]
.
I've tried type casting like this:
texts.content.get(0).asInstanceOf[TextArea].getText
And gott the following exception: java.lang.ClassCastException: javafx.scene.control.TextArea cannot be cast to scalafx.scene.control.TextArea