这是我的代码,我会在每个导致错误的位之前添加//和错误。
@Override
public void//Syntax error on token "void", @ expected start(Stage//Syntax error on token(s), misplaced construct(s) stage) throws//Syntax error on token "throws", interface expected Exception {
Parent root = FXMLLoader.load(getClass().getResource("fxml_example.fxml"));
Scene scene = new Scene(root, 300, 275);
stage.setTitle("FXML Welcome");//Syntax error on token ";", @ expected
stage.setScene(scene);//Syntax error on token ";", @ expected
stage.show()//Syntax error, insert ")" to complete MethodDeclaration;
}
答案 0 :(得分:0)
你似乎错过了`start方法的开头部分。
@Override
public void start(Stage stage) {
Parent root = FXMLLoader.load(getClass().getResource("fxml_example.fxml"));
Scene scene = new Scene(root, 300, 275);
stage.setTitle("FXML Welcome");//Syntax error on token ";", @ expected
stage.setScene(scene);//Syntax error on token ";", @ expected
stage.show();//You are missing semi-colon here.
}