From a24addf6ec4d229fedcc16440cb814bcec17133b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20K=C3=BChn?= Date: Tue, 18 Jan 2022 09:46:36 +0100 Subject: [PATCH] Changed checkbox to toggleButton, refactored code --- .../main/java/main/CreateEventController.java | 29 +++++++------------ .../src/main/resources/main/create-event.css | 1 - .../src/main/resources/main/create-event.fxml | 6 ++-- .../src/main/resources/main/edit-event.fxml | 6 ++-- 4 files changed, 18 insertions(+), 24 deletions(-) diff --git a/client/app/src/main/java/main/CreateEventController.java b/client/app/src/main/java/main/CreateEventController.java index b194213..33772c5 100644 --- a/client/app/src/main/java/main/CreateEventController.java +++ b/client/app/src/main/java/main/CreateEventController.java @@ -1,7 +1,6 @@ package main; -import com.jfoenix.controls.JFXTextField; -import com.jfoenix.controls.JFXTimePicker; +import com.jfoenix.controls.*; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.Node; @@ -28,9 +27,9 @@ public class CreateEventController { @FXML public ComboBox ComboBoxPriotity; @FXML - public CheckBox checkBoxIsFullDay; + public JFXToggleButton toggleBtnIsFullDay; @FXML - public CheckBox checkBoxIsPrivate; + public JFXToggleButton toggleBtnIsPrivate; @FXML public Label labelError; @FXML @@ -39,6 +38,7 @@ public class CreateEventController { public JFXTimePicker timeEnd; + public CreateEventController() { } @@ -46,20 +46,11 @@ public class CreateEventController { public void initialize() { StringConverter defaultConverter = new LocalTimeStringConverter(FormatStyle.SHORT, Locale.GERMANY); + timeStart.set24HourView(true); + timeStart.setConverter(defaultConverter); - JFXTimePicker timePickerStart = new JFXTimePicker(); - timeStart = timePickerStart; - timePickerStart.set24HourView(true); - timePickerStart.setConverter(defaultConverter); - timePickerStart.getStyleClass().add("timePicker"); - mainGrid.add(timePickerStart, 1 , 3); - - JFXTimePicker timePickerEnd = new JFXTimePicker(); - timeEnd = timePickerEnd; - timePickerEnd.set24HourView(true); - timePickerEnd.setConverter(defaultConverter); - timePickerEnd.getStyleClass().add("timePicker"); - mainGrid.add(timePickerEnd, 1 , 4); + timeEnd.set24HourView(true); + timeEnd.setConverter(defaultConverter); } @@ -73,8 +64,8 @@ public class CreateEventController { Event event = new Event( textName.getText(), ComboBoxPriotity.getSelectionModel().getSelectedIndex(), - checkBoxIsFullDay.isSelected(), - checkBoxIsPrivate.isSelected(), + toggleBtnIsFullDay.isSelected(), + toggleBtnIsPrivate.isSelected(), timeStart.getValue().toString(), timeEnd.getValue().toString(), datePickerDate.getValue().atStartOfDay(), diff --git a/client/app/src/main/resources/main/create-event.css b/client/app/src/main/resources/main/create-event.css index 1a49f33..be03557 100644 --- a/client/app/src/main/resources/main/create-event.css +++ b/client/app/src/main/resources/main/create-event.css @@ -61,5 +61,4 @@ JFXButton{ .timePicker{ -fx-background-color: white; - -fx-max-width: 200px; } \ No newline at end of file diff --git a/client/app/src/main/resources/main/create-event.fxml b/client/app/src/main/resources/main/create-event.fxml index f355352..e2798db 100644 --- a/client/app/src/main/resources/main/create-event.fxml +++ b/client/app/src/main/resources/main/create-event.fxml @@ -40,6 +40,8 @@ + + @@ -50,8 +52,8 @@ - - + +