Skip to content

Commit

Permalink
Add history on focus loss feature for SearchTextField
Browse files Browse the repository at this point in the history
A new checkbox is added to allow users to choose whether to add history on focus loss in the SearchTextField application. The respective fields are bound to the selected property of this new checkbox.
  • Loading branch information
dlemmermann committed May 10, 2024
1 parent be5fd62 commit 1345b39
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public void start(Stage primaryStage) throws Exception {
field1.addingItemToHistoryOnEnterProperty().bind(addHistoryOnActionBox.selectedProperty());
field2.addingItemToHistoryOnEnterProperty().bind(addHistoryOnActionBox.selectedProperty());

CheckBox addHistoryOnFocusLossBox = new CheckBox("Add History on Focus Loss");
addHistoryOnFocusLossBox.setSelected(true);
field1.addingItemToHistoryOnFocusLostProperty().bind(addHistoryOnFocusLossBox.selectedProperty());
field2.addingItemToHistoryOnFocusLostProperty().bind(addHistoryOnFocusLossBox.selectedProperty());

Button setHistoryButton = new Button("Set History");
setHistoryButton.setMaxWidth(Double.MAX_VALUE);
setHistoryButton.setOnAction(e -> {
Expand All @@ -75,7 +80,7 @@ public void start(Stage primaryStage) throws Exception {
});

VBox vbox = new VBox(20, new Label("Standard"), field1, new Label("Round"), field2,
new Separator(), maxHistorySizeBox, enableHistoryPopupBox, addHistoryOnActionBox,
new Separator(), maxHistorySizeBox, enableHistoryPopupBox, addHistoryOnActionBox, addHistoryOnFocusLossBox,
setHistoryButton, addHistoryButton, removeStandardHistoryButton, removeRoundHistoryButton, clearButton);
vbox.setPadding(new Insets(20));

Expand Down

0 comments on commit 1345b39

Please sign in to comment.