I'm new to JavaFX. I have my main and secondary scenes; when I change from the first scene to the second one, the window's bar becomes visible. How can I fix that?
Here is my code
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);
}
});
}
}