public static void main(String[] args) {
launch(args);
}
public static void menu(Stage stage){
Scanner input = new Scanner(System.in);
String option;
GridPane layout = new GridPane();
do {
System.out.println("1.Enter Y to show the Window\n2.Enter N to continue\n3.Enter Q to Quit");
System.out.print("Enter Option : ");
option = input.next();
if(option.equals("Y")) {
stage.show();
}
}while (!option.equals("Q"));
}
public void start(Stage stage) {
stage.setTitle("Window");
menu(stage);
}
我打开的窗口标题中没有响应。这有点像我为课程编写的程序中遇到的问题的逻辑
这是因为您没有结束循环,请在显示阶段后添加循环中断:
if(option.equals("Y")) {
stage.show();
break;
}