Skip to content

Commit b84b6d3

Browse files
committed
Refactor: Bindings.when
1 parent be6c2c0 commit b84b6d3

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

HMCL/src/main/java/org/jackhuang/hmcl/ui/main/ThemePackManagementPage.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -597,16 +597,9 @@ private void initializeList(ThemePackManagementPage skinnable, ComponentList roo
597597

598598
StackPane placeholderContainer = new StackPane();
599599
placeholderContainer.getStyleClass().add("notice-pane");
600-
Label placeholderLabel = new Label(i18n("search.no_results_found"));
600+
Label placeholderLabel = new Label();
601601
placeholderLabel.textProperty().bind(
602-
Bindings.createStringBinding(() -> {
603-
if (isSearching.get()) {
604-
return i18n("search.no_results_found");
605-
} else {
606-
return i18n("");
607-
}
608-
},
609-
isSearching)
602+
Bindings.when(isSearching).then(i18n("search.no_results_found")).otherwise("")
610603
);
611604
placeholderContainer.getChildren().add(placeholderLabel);
612605
listView.setPlaceholder(placeholderContainer);

0 commit comments

Comments
 (0)