0

I'm using javafx 2.2 with JDK 7 in Netbeans 7, with a code

Rectangle r = new Rectangle(200, 200);
tab_1.setContent(r);

which gives me error: rectangle cannot be converted to node. The tab_1 is a Tab instance.

According to the 2 docs, Rectangle is a subclass of Node.

Searching for similar problems only gave me the following SO question which I believe is unrelated: JavaFX error: incompatible types - Object cannot be converted to Node

In my understanding Rectangle is a Node, thus usable with setContent. What am I doing wrong?

1
  • 3
    Make sure you have the correct import: you should have javax.scene.shape.Rectangle
    – James_D
    Nov 26, 2014 at 13:05

1 Answer 1

3
import javafx.scene.shape.Rectangle;

Its unlikely anything other than a wrong import is causing this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.