()
| 178 | static Pane main_root; |
| 179 | |
| 180 | public static void start() { |
| 181 | |
| 182 | // we use a default pane without layout such as HBox, VBox etc. |
| 183 | final Pane root = new Pane(); |
| 184 | main_root = root; |
| 185 | final BorderPane root_desktop = new BorderPane(); |
| 186 | root.setPrefSize(800, 600); // Set default size of the window: (Width, height) |
| 187 | root.getChildren().add(root_desktop); |
| 188 | root_desktop.prefWidthProperty().bind(root.widthProperty()); // Fit root_desktop to root (yes, both Pane's are required.) |
| 189 | root_desktop.prefHeightProperty().bind(root.heightProperty()); |
| 190 | root_desktop.setBackground(Background.EMPTY); // Makes the background color transparent, else the background fills with color. |
| 191 | root.setBackground(Background.EMPTY); |
| 192 | //Wallpaper |
| 193 | Image backgroundImage = new Image(Apps.class.getResourceAsStream(LoginScreen.loginWallpaper)); |
| 194 | ImageView imageView = new ImageView(backgroundImage); |
| 195 | imageView.fitWidthProperty().bind(root.widthProperty()); |
| 196 | imageView.fitHeightProperty().bind(root.heightProperty()); |
| 197 | //Darken Effect |
| 198 | Lighting lighting = new Lighting(); |
| 199 | lighting.setDiffuseConstant(1.0); |
| 200 | lighting.setSpecularConstant(0.0); |
| 201 | lighting.setSpecularExponent(0.0); |
| 202 | lighting.setSurfaceScale(0.0); |
| 203 | lighting.setLight(new Light.Distant(45, 45, Color.GRAY)); //Note to future self: Don't ever use Color.BLACK here. It doesn't work. |
| 204 | //Blur Effect |
| 205 | GaussianBlur gaussianBlur = new GaussianBlur(); |
| 206 | gaussianBlur.setInput(lighting); //To set multiple effects |
| 207 | imageView.setEffect(gaussianBlur); |
| 208 | //then you set to your node |
| 209 | root.getChildren().add(imageView); |
| 210 | |
| 211 | |
| 212 | //Login window |
| 213 | BorderPane loginWindow = new BorderPane(); |
| 214 | loginWindow.getStylesheets().add("login.css"); |
| 215 | loginWindow.setStyle("-fx-background-color: rgba(100, 100, 100, .1);"); |
| 216 | loginWindow.setPrefSize(350, 600); //Size (Width, height) |
| 217 | // position the loginWindow |
| 218 | loginWindow.layoutXProperty().bind(root.widthProperty().subtract(loginWindow.widthProperty()).divide(2)); |
| 219 | loginWindow.layoutYProperty().bind(root.heightProperty().subtract(loginWindow.heightProperty()).divide(2)); |
| 220 | root.getChildren().add(loginWindow); |
| 221 | |
| 222 | //LoginScreen Content |
| 223 | VBox mainContent = new VBox(); |
| 224 | loginWindow.setCenter(mainContent); |
| 225 | //NixLogo |
| 226 | ImageView nixLogo = new ImageView(); |
| 227 | nixLogo.setPreserveRatio(true); |
| 228 | nixLogo.setFitWidth(250); //Image Size |
| 229 | Image logoSource = new Image(LoginScreen.class.getResourceAsStream("images/Logo.png")); |
| 230 | nixLogo.setImage(logoSource); |
| 231 | HBox logoFrame = new HBox(); |
| 232 | logoFrame.getChildren().add(nixLogo); |
| 233 | logoFrame.setPadding(new Insets(60, 55, 60, 55)); //Top, Right, Bottom, Left |
| 234 | loginWindow.setTop(logoFrame); |
| 235 | //Title |
| 236 | HBox titleBox = new HBox(); |
| 237 | titleBox.setPadding(new Insets(0, 0, 5, 15)); //Top, Right, Bottom, Left |
nothing calls this directly
no test coverage detected