[英]What am I doing wrong with passing Rectangle to setContent in javafx 2?
I'm using javafx 2.2 with JDK 7 in Netbeans 7, with a code 我在NetBeans 7中将Javafx 2.2与JDK 7结合使用
Rectangle r = new Rectangle(200, 200);
tab_1.setContent(r);
which gives me error: rectangle cannot be converted to node.
这给我一个
error: rectangle cannot be converted to node.
The tab_1
is a Tab
instance. tab_1
是一个Tab
实例。
According to the 2 docs , Rectangle is a subclass of Node
. 根据2文档 ,Rectangle是
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 搜索类似问题仅给了我以下与我不相关的SO问题: JavaFX错误:类型不兼容-无法将对象转换为Node
In my understanding Rectangle
is a Node
, thus usable with setContent
. 以我的理解,
Rectangle
是一个Node
,因此可以与setContent
。 What am I doing wrong? 我究竟做错了什么?
import javafx.scene.shape.Rectangle;
除了错误的导入外,几乎不可能引起此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.