@@ -130,6 +130,8 @@ public class ExternalProjectsSyncController {
130130 private final Color colorLoadingSuccess = Color .valueOf ("#74a317" );
131131 private final Color colorLoadingFailure = Color .valueOf ("#c63329" );
132132
133+ private boolean shiftDown = false ;
134+
133135 private final LocalTimeStringConverter localTimeStringConverter = new LocalTimeStringConverter (FormatStyle .MEDIUM );
134136
135137 private SearchPopup <HeimatTask > heimatTaskSearchPopup ;
@@ -633,24 +635,6 @@ private void showErrorDialog(List<String> errorMessages) {
633635
634636 private void setUpTimeSpinner (final Spinner <LocalTime > spinner ) {
635637
636- BooleanProperty shiftDown = new SimpleBooleanProperty (false );
637-
638- spinner .sceneProperty ().addListener ((obs , oldScene , newScene ) -> {
639- if (newScene != null ) {
640- newScene .addEventFilter (KeyEvent .KEY_RELEASED , event -> {
641- if (event .getCode () == KeyCode .SHIFT ) {
642- shiftDown .set (false );
643- }
644- });
645-
646- newScene .addEventFilter (KeyEvent .KEY_PRESSED , event -> {
647- if (event .getCode () == KeyCode .SHIFT ) {
648- shiftDown .set (true );
649- }
650- });
651- }
652- });
653-
654638 spinner .focusedProperty ().addListener (e -> {
655639 final LocalTimeStringConverter stringConverter = new LocalTimeStringConverter (FormatStyle .MEDIUM );
656640 final StringProperty text = spinner .getEditor ().textProperty ();
@@ -673,7 +657,7 @@ public void decrement(final int steps) {
673657 return ;
674658 final LocalTime time = getValue ();
675659
676- if (shiftDown . get () )
660+ if (shiftDown )
677661 setValue (decrementToNextHour (time ));
678662 else
679663 setValue (decrementToLastFullQuarter (time ));
@@ -689,7 +673,7 @@ public void increment(final int steps) {
689673 return ;
690674 final LocalTime time = getValue ();
691675
692- if (shiftDown . get () )
676+ if (shiftDown )
693677 setValue (incrementToNextHour (time ));
694678 else
695679 setValue (incrementToNextFullQuarter (time ));
@@ -727,6 +711,22 @@ public static LocalTime decrementToNextHour(LocalTime time) {
727711
728712 public void setStage (final Stage thisStage ) {
729713 this .thisStage = thisStage ;
714+
715+ registerKeyEventListenersForSpinners (thisStage );
716+ }
717+
718+ private void registerKeyEventListenersForSpinners (final Stage thisStage ) {
719+ thisStage .addEventFilter (KeyEvent .KEY_RELEASED , event -> {
720+ if (event .getCode () == KeyCode .SHIFT ) {
721+ shiftDown = false ;
722+ }
723+ });
724+
725+ thisStage .addEventFilter (KeyEvent .KEY_PRESSED , event -> {
726+ if (event .getCode () == KeyCode .SHIFT ) {
727+ shiftDown = true ;
728+ }
729+ });
730730 }
731731
732732 /**
0 commit comments