From 940d4f722ca01d6a2ffb9c02e5e4ff6d4597c16e Mon Sep 17 00:00:00 2001 From: Glavo Date: Wed, 20 Aug 2025 20:34:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20TaskListPane=20=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E5=87=BA=E7=8E=B0=E6=A8=AA=E5=90=91=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E6=9D=A1=E7=9A=84=E9=97=AE=E9=A2=98=20(#4297)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hmcl/ui/construct/TaskExecutorDialogPane.java | 13 +++---------- .../jackhuang/hmcl/ui/construct/TaskListPane.java | 8 ++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogPane.java index 0d74ba7d5..f8442e25b 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogPane.java @@ -22,7 +22,6 @@ import javafx.application.Platform; import javafx.beans.property.StringProperty; import javafx.geometry.Insets; import javafx.scene.control.Label; -import javafx.scene.control.ScrollPane; import javafx.scene.layout.BorderPane; import javafx.scene.layout.Priority; import javafx.scene.layout.VBox; @@ -59,16 +58,10 @@ public class TaskExecutorDialogPane extends BorderPane { lblTitle = new Label(); lblTitle.setStyle("-fx-font-size: 14px; -fx-font-weight: BOLD;"); - ScrollPane scrollPane = new ScrollPane(); - scrollPane.setFitToHeight(true); - scrollPane.setFitToWidth(true); - VBox.setVgrow(scrollPane, Priority.ALWAYS); - { - taskListPane = new TaskListPane(); - scrollPane.setContent(taskListPane); - } + taskListPane = new TaskListPane(); + VBox.setVgrow(taskListPane, Priority.ALWAYS); - center.getChildren().setAll(lblTitle, scrollPane); + center.getChildren().setAll(lblTitle, taskListPane); } BorderPane bottom = new BorderPane(); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskListPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskListPane.java index 71baa392f..39ffbcae1 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskListPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskListPane.java @@ -89,12 +89,18 @@ public final class TaskListPane extends StackPane { private final Map, ProgressListNode> nodes = new HashMap<>(); private final Map stageNodes = new HashMap<>(); private final ObjectProperty progressNodePadding = new SimpleObjectProperty<>(Insets.EMPTY); + private final DoubleProperty cellWidth = new SimpleDoubleProperty(); private Cell lastCell; public TaskListPane() { listView.setPadding(new Insets(12, 0, 0, 0)); listView.setCellFactory(l -> new Cell()); + FXUtils.onChangeAndOperate(listView.widthProperty(), width -> { + double w = width.doubleValue(); + cellWidth.set(w <= 12.0 ? w : w - 12.0); + }); + getChildren().setAll(listView); } @@ -274,6 +280,8 @@ public final class TaskListPane extends StackPane { private Cell() { setPadding(Insets.EMPTY); + prefWidthProperty().bind(cellWidth); + FXUtils.setLimitHeight(left, STATUS_ICON_SIZE); FXUtils.setLimitWidth(left, STATUS_ICON_SIZE);