Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: usere4d07
Added: Feb 19, 2019 9:01 PM
Views: 19
Tags: no tags
  1. import javafx.application.Application;
  2. import javafx.application.Platform;
  3. import javafx.fxml.FXMLLoader;
  4. import javafx.scene.Parent;
  5. import javafx.scene.Scene;
  6. import javafx.stage.Stage;
  7.  
  8. public class Main extends Application {
  9.  
  10.     @Override
  11.     public void start(Stage primaryStage) throws Exception {
  12.         Parent root = FXMLLoader.load(this.getClass().getResource("/GUI.fxml"));
  13.         primaryStage.setTitle("Document Database");
  14.         primaryStage.setScene(new Scene(root, 800, 800));
  15.         primaryStage.getScene().getStylesheets().add(this.getClass().getResource("/style.css").toString());
  16.         primaryStage.setOnCloseRequest(event -> {
  17.             Platform.exit();
  18.             System.exit(0);
  19.         });
  20.  
  21.         primaryStage.show();
  22.     }
  23.  
  24.     public static void main(String[] args) {
  25.         launch(args);
  26.     }
  27. }