0
에서 텍스트 값을 얻기는 내가 HBox의이 같은 말해봐 : HBox의
val texts = new HBox {
content = Seq(new TextArea, new TextArea)
}
가 지금은 컬렉션의
TextArea
의 '텍스트 값을 좀하고 싶습니다. 이
TextArea
에 어떻게 도달 할 수 있습니까?
texts.content
은
ObservableList[javafx.scene.Node]
이며
ObservableList[TextArea]
이 아닙니다. 이 같은
내가 해봤 타입 캐스팅 :
texts.content.get(0).asInstanceOf[TextArea].getText
그리고 다음과 같은 예외를 알아 들어 : java.lang.ClassCastException: javafx.scene.control.TextArea cannot be cast to scalafx.scene.control.TextArea
'TypeCasting'은 어떻습니까? – ItachiUchiha
나는'texts.content (0) .asInstanceOf [TextArea]'와'texts.content (0) match {case te : TextArea => ...}를 시도했는데 둘 다 예외가 발생했습니다. – Anton
와 일치합니다. 예외는 없지만'무익한 유형 테스트 : javafx.scene.Node 유형의 값은 scalafx.scene.control.TextArea'가 될 수 없습니다. – Anton