1

I have a question. I am learning JavaFX and I would like to use the javaFXML. The only problem is, I have a little problem with a pathTransion. You need a Node for the pathTransition, but I want to use a rectangle which is made in the SceneBuilder. I gave the rectangle an fx:id and I used that one, but when I want to use this into mij node it says it needs a node and not a rectangle and it can't transform the rectangle into a node. How can I resolve this problem? Thank you already, if someone needs more information just ask and i will give it. Thank you already for your help.

troy_frommer
  • 102
  • 1
  • 21
Gilian Joosen
  • 486
  • 3
  • 21

1 Answers1

0

Check your imports.

Are you sure you are using a javafx.scene.shape.Rectangle?

A javafx.scene.shape.Rectangle extends from Node so, it is a Node.

My guess is that you are mistakenly importing and using some other rectangle type, for example java.awt.Rectangle.

If your problem is not import related, then, edit your question to include an SSCCE, so that somebody can replicate your issue.

jewelsea
  • 150,031
  • 14
  • 366
  • 406