diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AccountList.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AccountList.java index 9164e908c..8be5ca8f7 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AccountList.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AccountList.java @@ -19,6 +19,7 @@ package org.jackhuang.hmcl.ui.account; import javafx.beans.property.*; import javafx.collections.FXCollections; +import javafx.collections.ObservableList; import javafx.scene.control.Control; import javafx.scene.control.Skin; import javafx.scene.control.ToggleGroup; @@ -47,13 +48,16 @@ public class AccountList extends Control implements DecoratorPage { }; private ToggleGroup toggleGroup; + private final ObservableList accountItems; public AccountList() { toggleGroup = new ToggleGroup(); - items.bindContent(MappedObservableList.create( + accountItems = MappedObservableList.create( Accounts.accountsProperty(), - account -> new AccountListItem(toggleGroup, account))); + account -> new AccountListItem(toggleGroup, account)); + + items.bindContent(accountItems); selectedAccount.bindBidirectional(Accounts.selectedAccountProperty()); toggleGroup.selectedToggleProperty().addListener((o, a, toggle) -> { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/profile/ProfileList.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/profile/ProfileList.java index fec55ec7b..51f1d6d28 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/profile/ProfileList.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/profile/ProfileList.java @@ -19,6 +19,7 @@ package org.jackhuang.hmcl.ui.profile; import javafx.beans.property.*; import javafx.collections.FXCollections; +import javafx.collections.ObservableList; import javafx.scene.control.Control; import javafx.scene.control.Skin; import javafx.scene.control.ToggleGroup; @@ -47,13 +48,16 @@ public class ProfileList extends Control implements DecoratorPage { }; private ToggleGroup toggleGroup; + private final ObservableList profileItems; public ProfileList() { toggleGroup = new ToggleGroup(); - items.bindContent(MappedObservableList.create( + profileItems = MappedObservableList.create( Profiles.profilesProperty(), - profile -> new ProfileListItem(toggleGroup, profile))); + profile -> new ProfileListItem(toggleGroup, profile)); + + items.bindContent(profileItems); selectedProfile.bindBidirectional(Profiles.selectedProfileProperty()); toggleGroup.selectedToggleProperty().addListener((o, a, toggle) -> {