diff options
author | Jonas Smedegaard <dr@jones.dk> | 2025-04-26 08:09:22 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2025-04-26 08:09:22 +0200 |
commit | 7f93e18b6424b292d4f54fb746aeb6e10b62e76d (patch) | |
tree | 0e9a7aed151580e74736f620ce08e1b811114d9a /dk/abcdefghijklmnopqrstuvxyzæøå/bachelorizer/view/Window.java | |
parent | 03c67a8832ef3469a6dba08436edac3f9b080aec (diff) |
use package domain dk.biks
Diffstat (limited to 'dk/abcdefghijklmnopqrstuvxyzæøå/bachelorizer/view/Window.java')
-rw-r--r-- | dk/abcdefghijklmnopqrstuvxyzæøå/bachelorizer/view/Window.java | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/dk/abcdefghijklmnopqrstuvxyzæøå/bachelorizer/view/Window.java b/dk/abcdefghijklmnopqrstuvxyzæøå/bachelorizer/view/Window.java deleted file mode 100644 index bf2af3d..0000000 --- a/dk/abcdefghijklmnopqrstuvxyzæøå/bachelorizer/view/Window.java +++ /dev/null @@ -1,120 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Jonas Smedegaard <dr@jones.dk> -// SPDX-License-Identifier: GPL-3.0-or-later - -package dk.abcdefghijklmnopqrstuvxyzæøå.bachelorizer.view; - -import java.util.List; -import javafx.application.Application; -import javafx.scene.control.Button; -import javafx.scene.control.Label; -import javafx.scene.control.TextArea; -import javafx.scene.control.TextField; -import javafx.scene.layout.HBox; -import javafx.scene.layout.VBox; -import javafx.scene.Scene; -import javafx.stage.Stage; - -import dk.abcdefghijklmnopqrstuvxyzæøå.bachelorizer.Control; -import dk.abcdefghijklmnopqrstuvxyzæøå.bachelorizer.model.GUI; - -/// Bachelorizer - JavaFX Window view -// Class is final to forbid subclassing, -// because object is passed to controller during instatiation -public final class Window extends Application { // the View - - /// Default constructor - // (declared explicitly only to silence javadoc) - public Window() { - } - - /// Label styling - public static String LABEL_STYLE = - "-fx-font-weight: bold; -fx-font-size: 20;"; - - /// Application model - private GUI model = new GUI(); - - /// Application controller - private Control control = new Control(model, this); - - /// Name of student - private TextField nameEntry = new TextField(); - - /// Text entry for adding an activity - private TextField activityEntry = new TextField(); - - /// Text area for activity entries - private TextArea area = new TextArea(); - - /// Button to delete one activity - private Button delOne = new Button("Delete one"); - - /// Button to delete all activities - private Button delAll = new Button("Delete all"); - - /// Application instantiation - /// - /// @param args application parameters - public static void main(String[] args) { - launch(args); - } - - @Override - public void start(Stage stage) { - - // pass application parameters to controller - control.setParameters(getParameters().getRaw()); - - // add listeners -// NameEntry.setOnAction(e -> control.enterName( -// activityEntry.getText())); - activityEntry.setOnAction(e -> control.enterActivity( - activityEntry.getText())); - delOne.setOnAction(e -> control.delOne()); - delAll.setOnAction(e -> control.delAll()); - - // add buttons - VBox root = new VBox(10, - ourHBox("Student", nameEntry), - ourHBox("Add activity", activityEntry), - new HBox(10, delOne, delAll), - area); - - // compose stage - Scene scene = new Scene(root, 500, 500); - stage.setTitle("JavaFX Demo"); - stage.setScene(scene); - stage.show(); - } - - /// action to apply student name - /// - /// @param s Text to apply - public void setStudentName(String s) { - nameEntry.setText(s); - } - - /// action to apply text to area - /// - /// @param s Text to apply - public void setArea(String s) { - area.setText(s); - } - - /// Button action to clear field - public void clearActivityEntry() { - activityEntry.setText(""); - } - - /// Styled HBox with label and TextField - /// - /// @param s Label string - /// @param f Text field - /// @return HBox containing styled label and text field - public HBox ourHBox(String s, TextField f) { - Label label = new Label(s+":"); - label.setStyle(LABEL_STYLE); - - return new HBox(10, label, f); - } -} |