Format Appointment Times

This commit is contained in:
2026-04-09 17:29:18 -06:00
parent fe7e81986d
commit 3631201435
2 changed files with 37 additions and 4 deletions

View File

@@ -83,6 +83,36 @@ public class AppointmentDialogController {
cbMinute.getItems().addAll(0, 15, 30, 45);
cbHour.setCellFactory(param -> new ListCell<>() {
@Override
protected void updateItem(Integer option, boolean empty) {
super.updateItem(option, empty);
setText(empty || option == null ? null : String.valueOf(option));
}
});
cbHour.setButtonCell(new ListCell<>() {
@Override
protected void updateItem(Integer option, boolean empty) {
super.updateItem(option, empty);
setText(empty || option == null ? null : String.valueOf(option));
}
});
cbMinute.setCellFactory(param -> new ListCell<>() {
@Override
protected void updateItem(Integer option, boolean empty) {
super.updateItem(option, empty);
setText(empty || option == null ? null : String.format("%02d", option));
}
});
cbMinute.setButtonCell(new ListCell<>() {
@Override
protected void updateItem(Integer option, boolean empty) {
super.updateItem(option, empty);
setText(empty || option == null ? null : String.format("%02d", option));
}
});
cbService.setCellFactory(param -> new ListCell<>() {
@Override
protected void updateItem(DropdownOption option, boolean empty) {

View File

@@ -12,9 +12,6 @@
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.layout.HBox?>
<VBox minHeight="-Infinity" minWidth="-Infinity" prefHeight="523.0" prefWidth="790.0"
spacing="20.0" style="-fx-font-size: 14px;"
xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"
@@ -156,7 +153,7 @@
</font>
</Label>
<HBox spacing="10">
<HBox spacing="10" alignment="CENTER_LEFT">
<!-- Hour -->
<ComboBox fx:id="cbHour"
@@ -172,6 +169,12 @@
</padding>
</ComboBox>
<Label text=":" textFill="#2c3e50">
<font>
<Font name="System Bold" size="18.0" />
</font>
</Label>
<!-- Minute -->
<ComboBox fx:id="cbMinute"
promptText="Minute"