From 0d105be15c91111e3d1f89e4f32417505e231d74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20K=C3=BChn?= Date: Thu, 13 Jan 2022 08:30:56 +0100 Subject: [PATCH] Created TimePicker and tried to add to grid --- .../main/java/main/CreateEventController.java | 25 ++++++++++++++----- .../src/main/java/main/MainController.java | 2 -- .../src/main/resources/main/edit-event.fxml | 6 ++--- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/client/app/src/main/java/main/CreateEventController.java b/client/app/src/main/java/main/CreateEventController.java index d77c407..64c6e2b 100644 --- a/client/app/src/main/java/main/CreateEventController.java +++ b/client/app/src/main/java/main/CreateEventController.java @@ -1,24 +1,24 @@ package main; +import com.jfoenix.controls.JFXTimePicker; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.Node; import javafx.scene.control.*; +import javafx.scene.layout.GridPane; import javafx.stage.Stage; import res.DataController; import res.Event; public class CreateEventController { + @FXML + public GridPane grid; @FXML public DatePicker datePickerDate; @FXML public TextField textName; @FXML - public TextField textStart; - @FXML - public TextField textEnd; - @FXML public ComboBox ComboBoxTyp; @FXML public ComboBox ComboBoxPriotity; @@ -28,6 +28,10 @@ public class CreateEventController { public CheckBox checkBoxIsPrivate; @FXML public Label labelError; + @FXML + public JFXTimePicker timeStart; + @FXML + public JFXTimePicker timeEnd; public CreateEventController() { @@ -35,6 +39,15 @@ public class CreateEventController { @FXML public void initialize() { + JFXTimePicker timePickerStart = new JFXTimePicker(); + timeStart = timePickerStart; + timePickerStart.set24HourView(true); + grid.add(timePickerStart, 1 , 3); + + JFXTimePicker timePickerEnd = new JFXTimePicker(); + timeEnd = timePickerEnd; + timePickerEnd.set24HourView(true); + grid.add(timePickerEnd, 1 , 4); } @@ -50,8 +63,8 @@ public class CreateEventController { ComboBoxPriotity.getSelectionModel().getSelectedIndex(), checkBoxIsFullDay.isSelected(), checkBoxIsPrivate.isSelected(), - textStart.getText(), - textEnd.getText(), + timeStart.toString(), + timeEnd.toString(), datePickerDate.getValue().atStartOfDay(), (int) DataController.USER_ID ); diff --git a/client/app/src/main/java/main/MainController.java b/client/app/src/main/java/main/MainController.java index b2d8d80..5354d3a 100644 --- a/client/app/src/main/java/main/MainController.java +++ b/client/app/src/main/java/main/MainController.java @@ -1,7 +1,5 @@ package main; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.geometry.Pos; diff --git a/client/app/src/main/resources/main/edit-event.fxml b/client/app/src/main/resources/main/edit-event.fxml index 029d566..b3e3021 100644 --- a/client/app/src/main/resources/main/edit-event.fxml +++ b/client/app/src/main/resources/main/edit-event.fxml @@ -2,10 +2,10 @@ - - @@ -39,8 +39,6 @@ - -