我让这个类在另一个文件中执行,java告诉我
"Unexpected return value",
我搜索并搜索过,看不出我做错了什么。我是一个庞大的Java Noob,所以任何帮助都会受到赞赏。
import javafx.stage.*;
import javafx.scene.*;
import javafx.scene.layout.*;
import javafx.scene.control.*;
import javafx.geometry.*;
public class PopUpBox {
public static void display(String title, String message) {
Stage window = new Stage();
TextField textField = new TextField();
//Block events to other windows
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle(title);
window.setMinWidth(250);
//Make a label that closes the window
Label label = new Label();
label.setText(message);
Button closeButton = new Button("Done");
closeButton.setOnAction(e -> {
Integer test = Integer.parseInt(textField.getText());
//return test;
System.out.println(test.getClass());
window.close();
}
);
VBox layout = new VBox(10);
layout.getChildren().addAll(textField, closeButton);
layout.setAlignment(Pos.CENTER);
//Display window and wait for it to be closed before returning
Scene scene = new Scene(layout);
window.setScene(scene);
window.showAndWait();
}
}