import javafx.application.Application;
import javafx.collections.ObservableList;
import javafx.event.*;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.scene.control.TextArea;

public class RT16343 extends Application {

    public void start(Stage stage) {
       stage.setTitle("primary stage");
       addComponents(stage);
       Stage stage1 = new Stage();
       stage1.setTitle("secondary stage");
       addComponents(stage1);
    }

    private void addComponents(final Stage stage) {
        Group root = new Group();
        Scene scene = new Scene(root, 600D, 450D);
        scene.setFill(Color.LIGHTBLUE);
        final Button button = new Button("Toggle Fullscreen");
        button.setLayoutX(25D);
        button.setLayoutY(40D);
        button.setOnAction(new EventHandler<ActionEvent>() {
           @Override public void handle(ActionEvent event) {
               stage.setFullScreen(!stage.isFullScreen());
                System.out.println(">>>>>> isFullscreen ? "+stage.isFullScreen());
            }
        });
        root.getChildren().add(button);
        TextArea ta = new TextArea();
        root.getChildren().add(ta);
        ta.setLayoutX(40D);
        ta.setLayoutY(80D);
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String args[]) {
        launch(args);
    }
}