From 553e67bda748b5e76efb28279447485c6bfaacf7 Mon Sep 17 00:00:00 2001 From: Glavo Date: Sat, 10 Jan 2026 16:17:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20JFXCheckBox=20=E6=84=8F?= =?UTF-8?q?=E5=A4=96=E5=9C=B0=E6=98=BE=E7=A4=BA=E9=98=B4=E5=BD=B1=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#5179)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HMCL/src/main/java/com/jfoenix/skins/JFXCheckBoxSkin.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/HMCL/src/main/java/com/jfoenix/skins/JFXCheckBoxSkin.java b/HMCL/src/main/java/com/jfoenix/skins/JFXCheckBoxSkin.java index f6aaa1d68..cb9837699 100644 --- a/HMCL/src/main/java/com/jfoenix/skins/JFXCheckBoxSkin.java +++ b/HMCL/src/main/java/com/jfoenix/skins/JFXCheckBoxSkin.java @@ -17,6 +17,7 @@ import javafx.animation.KeyFrame; import javafx.animation.KeyValue; import javafx.animation.Timeline; import javafx.animation.Transition; +import javafx.beans.property.ReadOnlyBooleanProperty; import javafx.geometry.HPos; import javafx.geometry.Insets; import javafx.geometry.VPos; @@ -35,6 +36,7 @@ import javafx.scene.paint.Color; import javafx.scene.shape.SVGPath; import javafx.util.Duration; import org.jackhuang.hmcl.theme.Themes; +import org.jackhuang.hmcl.ui.FXUtils; public class JFXCheckBoxSkin extends CheckBoxSkin { private final StackPane box = new StackPane(); @@ -75,7 +77,11 @@ public class JFXCheckBoxSkin extends CheckBoxSkin { this.updateRippleColor(); this.playSelectAnimation(newVal); }); - control.focusedProperty().addListener((o, oldVal, newVal) -> { + + ReadOnlyBooleanProperty focusVisibleProperty = FXUtils.focusVisibleProperty(control); + if (focusVisibleProperty == null) + focusVisibleProperty = control.focusedProperty(); + focusVisibleProperty.addListener((o, oldVal, newVal) -> { if (newVal) { if (!this.getSkinnable().isPressed()) { this.rippler.showOverlay();