Created TimePicker and tried to add to grid

This commit is contained in:
Marco Kühn 2022-01-13 08:30:56 +01:00
parent eb55d5c650
commit 0d105be15c
3 changed files with 21 additions and 12 deletions

View File

@ -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<String> ComboBoxTyp;
@FXML
public ComboBox<String> 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
);

View File

@ -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;

View File

@ -2,10 +2,10 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.collections.FXCollections?>
<?import java.lang.String?>
<GridPane xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
<GridPane fx:id="grid" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="main.CreateEventController">
<columnConstraints>
@ -39,8 +39,6 @@
<DatePicker fx:id="datePickerDate" GridPane.columnIndex="1" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
<TextField fx:id="textName" GridPane.columnIndex="1" GridPane.rowIndex="2" maxWidth="400" minWidth="400"/>
<TextField fx:id="textStart" GridPane.columnIndex="1" GridPane.rowIndex="3" maxWidth="400" minWidth="400"/>
<TextField fx:id="textEnd" GridPane.columnIndex="1" GridPane.rowIndex="4" maxWidth="400" minWidth="400"/>
<ComboBox fx:id="ComboBoxTyp" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="400" minWidth="400"/>
<ComboBox fx:id="ComboBoxPriotity" GridPane.columnIndex="1" GridPane.rowIndex="6" maxWidth="200" minWidth="200">
<items>