Skip to content

Commit

Permalink
Merge pull request #166 from dlsc-software-consulting-gmbh/fix-picker…
Browse files Browse the repository at this point in the history
…-esc-behavior

 Fix Issue with Picker Component Closure Behavior
  • Loading branch information
dlemmermann authored May 2, 2024
2 parents 2db0b87 + eed3878 commit 6ba35a0
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import javafx.event.Event;
import javafx.scene.control.ComboBoxBase;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;

public abstract class ToggleVisibilityComboBoxSkin<T extends ComboBoxBase> extends CustomComboBoxSkinBase<T> {
Expand All @@ -11,6 +13,14 @@ public abstract class ToggleVisibilityComboBoxSkin<T extends ComboBoxBase> exten

public ToggleVisibilityComboBoxSkin(T control) {
super(control);

// Pressed the esc key to hide the popup.
control.addEventFilter(KeyEvent.KEY_PRESSED, e -> {
if (e.getCode() == KeyCode.ESCAPE) {
showPopupOnMouseRelease = true;
hide();
}
});
}

@Override
Expand Down

0 comments on commit 6ba35a0

Please sign in to comment.