From 794be4694f1a1fa36d87543aab840331c6d39745 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Tue, 29 Apr 2025 07:51:09 +0200 Subject: explicitly define magic numbers --- .../dk/biks/bachelorizer/Window.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/dk.biks.bachelorizer/dk/biks/bachelorizer/Window.java') diff --git a/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Window.java b/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Window.java index df29ced..d75e05c 100644 --- a/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Window.java +++ b/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Window.java @@ -24,8 +24,17 @@ public final class Window extends Application { public Window() { } + /// window width + private static final int WINDOW_WIDTH = 500; + + /// window height + private static final int WINDOW_HEIGHT = 500; + + /// box height + private static final int BOX_HEIGHT = 10; + /// Label styling - public static String LABEL_STYLE = + private static String LABEL_STYLE = "-fx-font-weight: bold; -fx-font-size: 20;"; /// Application model @@ -71,14 +80,14 @@ public final class Window extends Application { delAll.setOnAction(e -> control.delAll()); // add buttons - VBox root = new VBox(10, + VBox root = new VBox(BOX_HEIGHT, ourHBox("Student", nameEntry), ourHBox("Add activity", activityEntry), - new HBox(10, delOne, delAll), + new HBox(BOX_HEIGHT, delOne, delAll), area); // compose stage - Scene scene = new Scene(root, 500, 500); + Scene scene = new Scene(root, WINDOW_WIDTH, WINDOW_HEIGHT); stage.setTitle("JavaFX Demo"); stage.setScene(scene); stage.show(); @@ -112,6 +121,6 @@ public final class Window extends Application { Label label = new Label(s + ":"); label.setStyle(LABEL_STYLE); - return new HBox(10, label, f); + return new HBox(BOX_HEIGHT, label, f); } } -- cgit v1.2.3