stage = primaryStage;
Text message = new Text();
pane1 = new GridPane();
pane1.add(message, 0, 0);
scene1 = new Scene(pane1);
//scene2 is built and similar to scene.
if (getAns() == false) {
message.setText("Wrong");
stage.setScene(scene1);
} else {
message.setText("Correct");
stage.setScene(scene2);
}
stage.setTitle("Test");
stage.show();
当getAns()为true时,显示消息。当getAns()为false时,不显示消息,为什么?
答案 0 :(得分:0)
message is displayed in scene1. So if you display scene2, you can't see it. (It can't be in two different scenes.) – James_D Oct 4 at 15:41