【发布时间】:2015-12-16 18:41:01
【问题描述】:
我正在尝试设置Image 对象的Image。我的代码:
Image photo = new Image("http://example.com/image.jpg", 100, 0, false, false);
ImageView face = new ImageView();
face.setImage(photo);
我在第 2 行和第 3 行遇到错误,但我非常关注 the documentation。 文档摘录:
// load the image
Image image = new Image("flower.png");
// simple displays ImageView the image as is
ImageView iv1 = new ImageView();
iv1.setImage(image);
错误
第 2 行:
java: constructor ImageView in class javax.swing.text.html.ImageView cannot be applied to given types;
required: javax.swing.text.Element
found: no arguments
reason: actual and formal argument lists differ in length
第 3 行:
java: cannot find symbol
symbol: method setImage(javafx.scene.image.Image)
location: variable face of type javax.swing.text.html.ImageView
【问题讨论】:
-
您可以将错误添加到您的问题中吗?
-
编译错误还是运行时错误?如果是编译错误,请包含您的导入。
标签: java image javafx javafx-8