问题描述
我正在尝试从标准 javafx.scene.shape 创建一个简单的圆。 * 班级。当我尝试编译程序时,我收到以下错误消息。我正在使用 Java 8.291! 我尝试用一个参数创建一个圆圈,但错误消息告诉我不需要参数。
test2.java:33: error: constructor Circle in class Circle cannot be applied to given types;
Circle circleA = new Circle(20);
^
**required: no arguments
found: int**
reason: actual and formal argument lists differ in length
test2.java:35: error: no suitable method found for addAll(Circle)
rootNode.getChildren().addAll(circleA);
^
method Collection.addAll(Collection<? extends Node>) is not applicable
(argument mismatch; Circle cannot be converted to Collection<? extends Node>)
method List.addAll(Collection<? extends Node>) is not applicable
(argument mismatch; Circle cannot be converted to Collection<? extends Node>)
method ObservableList.addAll(Node...) is not applicable
(varargs mismatch; Circle cannot be converted to Node)
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors
import javafx.application.*;
import javafx.scene.*;
import javafx.stage.*;
import javafx.scene.layout.*;
import javafx.geometry.*;
import javafx.scene.transform.*;
import javafx.scene.shape.*;
public class test2 extends Application{
public static void main(String[] args){
// Start the JavaFX application by calling launch().
launch(args);
}
// Override the start() method.
public void start(Stage myStage){
myStage.setTitle("Transformer");
FlowPane rootNode = new FlowPane(40,40);
rootNode.setAlignment(Pos.CENTER);
Scene myScene = new Scene(rootNode,500,200);
myStage.setScene(myScene);
Circle circleA = new Circle(20);
rootNode.getChildren().addAll(circleA);
myStage.show();
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)