我是 JavaFX 的新手。我有我的主要和次要场景;当我从第一个场景更改为第二个场景时,窗口的栏变得可见。我该如何解决?
这是我的代码
public class ProyectoTeoriaBD1 extends Application {
Stage primaryStage;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(final Stage primaryStage) {
this.primaryStage = primaryStage;
GridPane gp = new GridPane();
gp.setHgap(10);
gp.setVgap(10);
gp.setPadding(new Insets(25,25,25,25));
Scene firstScene = new Scene(gp);
Button b = new Button("Change Scene");
gp.add(b,1,1);
primaryStage.setScene(firstScene);
primaryStage.setFullScreen(true);
primaryStage.show();
b.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
GridPane gp = new GridPane();
Scene secondScene = new Scene(gp);
Text txtSecond = new Text("Second Scene");
gp.add(txtSecond, 1, 1);
primaryStage.setScene(secondScene);
primaryStage.setFullScreen(false);
primaryStage.setFullScreen(true);
}
});
}
}