Changed checkbox to toggleButton, refactored code
This commit is contained in:
parent
53b631678a
commit
a24addf6ec
@ -1,7 +1,6 @@
|
|||||||
package main;
|
package main;
|
||||||
|
|
||||||
import com.jfoenix.controls.JFXTextField;
|
import com.jfoenix.controls.*;
|
||||||
import com.jfoenix.controls.JFXTimePicker;
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
@ -28,9 +27,9 @@ public class CreateEventController {
|
|||||||
@FXML
|
@FXML
|
||||||
public ComboBox<String> ComboBoxPriotity;
|
public ComboBox<String> ComboBoxPriotity;
|
||||||
@FXML
|
@FXML
|
||||||
public CheckBox checkBoxIsFullDay;
|
public JFXToggleButton toggleBtnIsFullDay;
|
||||||
@FXML
|
@FXML
|
||||||
public CheckBox checkBoxIsPrivate;
|
public JFXToggleButton toggleBtnIsPrivate;
|
||||||
@FXML
|
@FXML
|
||||||
public Label labelError;
|
public Label labelError;
|
||||||
@FXML
|
@FXML
|
||||||
@ -39,6 +38,7 @@ public class CreateEventController {
|
|||||||
public JFXTimePicker timeEnd;
|
public JFXTimePicker timeEnd;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public CreateEventController() {
|
public CreateEventController() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,20 +46,11 @@ public class CreateEventController {
|
|||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
|
||||||
StringConverter<LocalTime> defaultConverter = new LocalTimeStringConverter(FormatStyle.SHORT, Locale.GERMANY);
|
StringConverter<LocalTime> defaultConverter = new LocalTimeStringConverter(FormatStyle.SHORT, Locale.GERMANY);
|
||||||
|
timeStart.set24HourView(true);
|
||||||
|
timeStart.setConverter(defaultConverter);
|
||||||
|
|
||||||
JFXTimePicker timePickerStart = new JFXTimePicker();
|
timeEnd.set24HourView(true);
|
||||||
timeStart = timePickerStart;
|
timeEnd.setConverter(defaultConverter);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -73,8 +64,8 @@ public class CreateEventController {
|
|||||||
Event event = new Event(
|
Event event = new Event(
|
||||||
textName.getText(),
|
textName.getText(),
|
||||||
ComboBoxPriotity.getSelectionModel().getSelectedIndex(),
|
ComboBoxPriotity.getSelectionModel().getSelectedIndex(),
|
||||||
checkBoxIsFullDay.isSelected(),
|
toggleBtnIsFullDay.isSelected(),
|
||||||
checkBoxIsPrivate.isSelected(),
|
toggleBtnIsPrivate.isSelected(),
|
||||||
timeStart.getValue().toString(),
|
timeStart.getValue().toString(),
|
||||||
timeEnd.getValue().toString(),
|
timeEnd.getValue().toString(),
|
||||||
datePickerDate.getValue().atStartOfDay(),
|
datePickerDate.getValue().atStartOfDay(),
|
||||||
|
@ -61,5 +61,4 @@ JFXButton{
|
|||||||
|
|
||||||
.timePicker{
|
.timePicker{
|
||||||
-fx-background-color: white;
|
-fx-background-color: white;
|
||||||
-fx-max-width: 200px;
|
|
||||||
}
|
}
|
@ -40,6 +40,8 @@
|
|||||||
|
|
||||||
<JFXTextField styleClass="inputField" fx:id="textName" GridPane.columnIndex="1" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
|
<JFXTextField styleClass="inputField" fx:id="textName" GridPane.columnIndex="1" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
|
||||||
<JFXDatePicker styleClass="inputDate" fx:id="datePickerDate" GridPane.columnIndex="1" GridPane.rowIndex="2" maxWidth="200" minWidth="200"/>
|
<JFXDatePicker styleClass="inputDate" fx:id="datePickerDate" GridPane.columnIndex="1" GridPane.rowIndex="2" maxWidth="200" minWidth="200"/>
|
||||||
|
<JFXTimePicker styleClass="timePicker" fx:id="timeStart" GridPane.columnIndex="1" GridPane.rowIndex="3" maxWidth="200" minWidth="200"/>
|
||||||
|
<JFXTimePicker styleClass="timePicker" fx:id="timeEnd" GridPane.columnIndex="1" GridPane.rowIndex="4" maxWidth="200" minWidth="200"/>
|
||||||
|
|
||||||
<JFXComboBox fx:id="ComboBoxPriotity" styleClass="comboBox" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="200" minWidth="200">
|
<JFXComboBox fx:id="ComboBoxPriotity" styleClass="comboBox" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="200" minWidth="200">
|
||||||
<items>
|
<items>
|
||||||
@ -50,8 +52,8 @@
|
|||||||
</FXCollections>
|
</FXCollections>
|
||||||
</items>
|
</items>
|
||||||
</JFXComboBox>
|
</JFXComboBox>
|
||||||
<JFXCheckBox styleClass="checkbox" fx:id="checkBoxIsFullDay" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
|
<JFXToggleButton styleClass="checkbox" fx:id="toggleBtnIsFullDay" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
|
||||||
<JFXCheckBox styleClass="checkbox" fx:id="checkBoxIsPrivate" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
|
<JFXToggleButton styleClass="checkbox" fx:id="toggleBtnIsPrivate" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
|
||||||
<Label fx:id="labelError" GridPane.columnIndex="1" GridPane.rowIndex="8"/>
|
<Label fx:id="labelError" GridPane.columnIndex="1" GridPane.rowIndex="8"/>
|
||||||
|
|
||||||
<HBox GridPane.columnIndex="1" GridPane.rowIndex="9" GridPane.columnSpan="2" alignment="CENTER_RIGHT">
|
<HBox GridPane.columnIndex="1" GridPane.rowIndex="9" GridPane.columnSpan="2" alignment="CENTER_RIGHT">
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
|
|
||||||
<JFXTextField styleClass="inputField" fx:id="textName" GridPane.columnIndex="1" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
|
<JFXTextField styleClass="inputField" fx:id="textName" GridPane.columnIndex="1" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
|
||||||
<JFXDatePicker styleClass="inputDate" fx:id="datePickerDate" GridPane.columnIndex="1" GridPane.rowIndex="2" maxWidth="200" minWidth="200"/>
|
<JFXDatePicker styleClass="inputDate" fx:id="datePickerDate" GridPane.columnIndex="1" GridPane.rowIndex="2" maxWidth="200" minWidth="200"/>
|
||||||
|
<JFXTimePicker styleClass="timePicker" fx:id="timeStart" GridPane.columnIndex="1" GridPane.rowIndex="3" maxWidth="200" minWidth="200"/>
|
||||||
|
<JFXTimePicker styleClass="timePicker" fx:id="timeEnd" GridPane.columnIndex="1" GridPane.rowIndex="4" maxWidth="200" minWidth="200"/>
|
||||||
|
|
||||||
<JFXComboBox fx:id="ComboBoxPriotity" styleClass="comboBox" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="200" minWidth="200">
|
<JFXComboBox fx:id="ComboBoxPriotity" styleClass="comboBox" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="200" minWidth="200">
|
||||||
<items>
|
<items>
|
||||||
@ -50,8 +52,8 @@
|
|||||||
</FXCollections>
|
</FXCollections>
|
||||||
</items>
|
</items>
|
||||||
</JFXComboBox>
|
</JFXComboBox>
|
||||||
<JFXCheckBox styleClass="checkbox" fx:id="checkBoxIsFullDay" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
|
<JFXToggleButton styleClass="checkbox" fx:id="toggleBtnIsFullDay" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
|
||||||
<JFXCheckBox styleClass="checkbox" fx:id="checkBoxIsPrivate" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
|
<JFXToggleButton styleClass="checkbox" fx:id="toggleBtnIsPrivate" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
|
||||||
<Label fx:id="labelError" GridPane.columnIndex="1" GridPane.rowIndex="8"/>
|
<Label fx:id="labelError" GridPane.columnIndex="1" GridPane.rowIndex="8"/>
|
||||||
|
|
||||||
<HBox GridPane.columnIndex="1" GridPane.rowIndex="9" GridPane.columnSpan="2" alignment="CENTER_RIGHT">
|
<HBox GridPane.columnIndex="1" GridPane.rowIndex="9" GridPane.columnSpan="2" alignment="CENTER_RIGHT">
|
||||||
|
Loading…
Reference in New Issue
Block a user