MCPcopy Create free account
hub / github.com/TheCyaniteProject/exit_code_java / setDefaultStartMenu

Method setDefaultStartMenu

src/main/java/exitcode/Apps.java:303–358  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

301 }
302
303 public static void setDefaultStartMenu() {
304 BorderPane window = new BorderPane();
305 API.setStartMenu(() -> {
306 window.getStylesheets().add("config.css");
307 window.setStyle(Apps.windowMainColor + "-fx-border-style: solid; -fx-border-width: 2;" + String.format("-fx-border-color%s", Desktop.taskbarMainColor.replace("-fx-background-color", "")));
308 window.setPrefSize(175, 250);
309 Desktop.main_root.getChildren().add(window);
310 //window.setLayoutX(100);
311 window.layoutYProperty().bind(Desktop.main_root.heightProperty().subtract(Desktop.desktop_taskbar.heightProperty()).subtract(window.heightProperty()));
312
313 ScrollPane contentHolder = new ScrollPane();
314 window.setTop(contentHolder);
315 contentHolder.prefWidthProperty().bind(window.widthProperty());
316
317 VBox menuContent = new VBox();
318 contentHolder.setContent(menuContent);
319
320 for (Map.Entry<String, Runnable> entry : Apps.appButtons.entrySet()) {
321 Button button = new Button(entry.getKey());
322 menuContent.getChildren().add(button);
323 button.setOnAction(click -> {
324 Apps.closeStartMenu();
325 entry.getValue().run();
326 });
327 }
328
329 HBox systemBar = new HBox();
330 window.setBottom(systemBar);
331
332 Button logoutButton = new Button("Logout");
333
334 Region region = new Region();
335 HBox.setHgrow(region, Priority.ALWAYS);
336
337 Button shutdownButton = new Button("Shutdown");
338
339 shutdownButton.setOnAction(click -> {
340 closeStartMenu();
341 create_ConfirmPopup_Window("Shutdown", "Are you sure you want to shutdown?\nAll unsaved progress will be lost.\n ", () -> {
342 Desktop.shutdown();
343 }, null);
344 });
345
346 logoutButton.setOnAction(click -> {
347 closeStartMenu();
348 create_ConfirmPopup_Window("Logout", "Are you sure you want to logout?\nAll unsaved progress will be lost.\n ", () -> {
349 Desktop.logout();
350 }, null);
351 });
352
353 systemBar.getChildren().addAll(logoutButton, region, shutdownButton);
354 });
355 API.setStartMenuClose(() -> {
356 Desktop.main_root.getChildren().remove(window);
357 });
358 }
359
360}

Callers 1

startMethod · 0.95

Calls 8

setStartMenuMethod · 0.95
closeStartMenuMethod · 0.95
shutdownMethod · 0.95
logoutMethod · 0.95
setStartMenuCloseMethod · 0.95
setPrefSizeMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected