Close stage window : Stage « JavaFX « Java






Close stage window

 
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class Main extends Application {

    @Override
    public void start(Stage stage) {
        Text text = new Text("!");
        text.setFont(new Font(40));
        VBox box = new VBox();
        box.getChildren().add(text);
        final Scene scene = new Scene(box,300, 250);
        scene.setFill(null);
        stage.setScene(scene);
        stage.show();
        stage.close();
    }

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

   
  








Related examples in the same category

1.Show UNDECORATED window
2.Set title for Window
3.Stage as a Dialog
4.TRANSPARENT window
5.Move Stage window to back
6.Moving stage window to front
7.Stage close event
8.Full screen stage
9.sizeToScene