Fix #6398: Java列表无法刷新版本信息 (#6808)

Close #6398
This commit is contained in:
Wulian233
2026-09-04 21:03:49 +08:00
committed by GitHub
parent a4b930ded5
commit 7dfc654d5d
@@ -21,7 +21,6 @@ import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXListView;
import javafx.beans.binding.Bindings;
import javafx.beans.value.ChangeListener;
import javafx.collections.FXCollections;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
@@ -184,7 +183,10 @@ public final class JavaManagementPage extends ListPageBase<JavaRuntime> {
@FXThread
private void loadJava(Collection<JavaRuntime> javaRuntimes) {
if (javaRuntimes != null) {
this.setItems(FXCollections.observableArrayList(javaRuntimes));
// JavaRuntime equality is path-based. setAll can therefore retain a stale item when the
// Java installation at an existing path has been upgraded.
this.getItems().clear();
this.getItems().addAll(javaRuntimes);
this.setLoading(false);
} else {
this.setLoading(true);