From b132aba1e36a54af20dcd6ee69792c6af790a1f9 Mon Sep 17 00:00:00 2001 From: Glavo Date: Sat, 7 Jan 2023 21:34:01 +0800 Subject: [PATCH] fix #1927: limit title label width (#1982) --- .../java/org/jackhuang/hmcl/ui/decorator/DecoratorSkin.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorSkin.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorSkin.java index 6b36025e6..1fe263bf5 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorSkin.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorSkin.java @@ -261,7 +261,11 @@ public class DecoratorSkin extends SkinBase { Label titleLabel = new Label(); BorderPane.setAlignment(titleLabel, Pos.CENTER_LEFT); titleLabel.getStyleClass().add("jfx-decorator-title"); - if (titleNode != null) { + if (titleNode == null) { + titleLabel.maxWidthProperty().bind(Bindings.createDoubleBinding( + () -> skinnable.getWidth() - 100 - navLeft.getWidth(), + skinnable.widthProperty(), navLeft.widthProperty())); + } else { titleLabel.prefWidthProperty().bind(Bindings.createDoubleBinding(() -> { // 8 (margin-left) return leftPaneWidth - 8 - navLeft.getWidth();