()
| 514 | static Pane main_root; |
| 515 | |
| 516 | public static void start() { |
| 517 | |
| 518 | // we use a default pane without layout such as HBox, VBox etc. |
| 519 | final Pane root = new Pane(); |
| 520 | NameSystem.main_root = root; |
| 521 | final BorderPane root_desktop = new BorderPane(); |
| 522 | root.setPrefSize(800, 600); // Set default size of the window: (Width, height) |
| 523 | root.getChildren().add(root_desktop); |
| 524 | root_desktop.prefWidthProperty().bind(root.widthProperty()); // Fit root_desktop to root (yes, both Pane's are required.) |
| 525 | root_desktop.prefHeightProperty().bind(root.heightProperty()); |
| 526 | root_desktop.setBackground(Background.EMPTY); // Makes the background color transparent, else the background fills with color. |
| 527 | root.setBackground(Background.EMPTY); |
| 528 | //Wallpaper |
| 529 | Image backgroundImage = new Image(LoginScreen.class.getResourceAsStream(LoginScreen.loginWallpaper)); |
| 530 | ImageView imageView = new ImageView(backgroundImage); |
| 531 | imageView.fitWidthProperty().bind(root.widthProperty()); |
| 532 | imageView.fitHeightProperty().bind(root.heightProperty()); |
| 533 | //Darken Effect |
| 534 | Lighting lighting = new Lighting(); |
| 535 | lighting.setDiffuseConstant(1.0); |
| 536 | lighting.setSpecularConstant(0.0); |
| 537 | lighting.setSpecularExponent(0.0); |
| 538 | lighting.setSurfaceScale(0.0); |
| 539 | lighting.setLight(new Light.Distant(45, 45, Color.GRAY)); //Note to future self: Don't ever use Color.BLACK here. It doesn't work. |
| 540 | //imageView.setEffect(lighting); |
| 541 | //Blur Effect |
| 542 | GaussianBlur gaussianBlur = new GaussianBlur(); |
| 543 | gaussianBlur.setInput(lighting); //To set multiple effects |
| 544 | imageView.setEffect(gaussianBlur); |
| 545 | //then you set to your node |
| 546 | root.getChildren().add(imageView); |
| 547 | |
| 548 | //Login window |
| 549 | BorderPane loginWindow = new BorderPane(); |
| 550 | loginWindow.getStylesheets().add("login.css"); |
| 551 | loginWindow.setStyle("-fx-background-color: rgba(100, 100, 100, .1);"); |
| 552 | loginWindow.setPrefSize(700, 500); //Size (Width, height) |
| 553 | // position the loginWindow |
| 554 | loginWindow.layoutXProperty().bind(root.widthProperty().subtract(loginWindow.widthProperty()).divide(2)); |
| 555 | loginWindow.layoutYProperty().bind(root.heightProperty().subtract(loginWindow.heightProperty()).divide(2)); |
| 556 | root.getChildren().add(loginWindow); |
| 557 | |
| 558 | //LoginScreen Content |
| 559 | VBox mainContent = new VBox(); |
| 560 | mainContent.setPadding(new Insets(50,80,0,80)); //Top, Right, Bottom, Left |
| 561 | loginWindow.setCenter(mainContent); |
| 562 | //NixLogo |
| 563 | ImageView nixLogo = new ImageView(); |
| 564 | nixLogo.setPreserveRatio(true); |
| 565 | nixLogo.setFitWidth(250); //Image Size |
| 566 | Image logoSource = new Image(LoginScreen.class.getResourceAsStream("images/Logo.png")); |
| 567 | nixLogo.setImage(logoSource); |
| 568 | HBox logoFrame = new HBox(); |
| 569 | logoFrame.getChildren().add(nixLogo); |
| 570 | logoFrame.setPadding(new Insets(0,0,40,0)); //Top, Right, Bottom, Left |
| 571 | mainContent.getChildren().add(logoFrame); |
| 572 | //Label |
| 573 | Label systemLabel = new Label("Welcome to the PiXEl OS installation!"); |
nothing calls this directly
no test coverage detected