From 5bc179266c8132da59899b646628feb1fc77e45c Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Tue, 1 Sep 2020 01:03:04 +0200 Subject: [PATCH 1/2] Apply css files correctly to dialogs Fixes #6039. --- CHANGELOG.md | 1 + src/main/java/org/jabref/gui/util/BaseDialog.java | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f4c1efa05f..e634dd27c7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Changed ### Fixed +- We fixed the wrong behavior that font size changes are not reflected in dialogs. [#6039](https://github.com/JabRef/jabref/issues/6039) ### Removed diff --git a/src/main/java/org/jabref/gui/util/BaseDialog.java b/src/main/java/org/jabref/gui/util/BaseDialog.java index 921be10e748..fde9d17abbc 100644 --- a/src/main/java/org/jabref/gui/util/BaseDialog.java +++ b/src/main/java/org/jabref/gui/util/BaseDialog.java @@ -2,6 +2,7 @@ import java.util.Optional; +import javafx.scene.Node; import javafx.scene.control.Button; import javafx.scene.control.ButtonType; import javafx.scene.control.Dialog; @@ -14,6 +15,8 @@ import org.jabref.gui.keyboard.KeyBinding; import org.jabref.gui.keyboard.KeyBindingRepository; +import com.tobiasdiez.easybind.EasyBind; + public class BaseDialog extends Dialog implements org.jabref.gui.Dialog { protected BaseDialog() { @@ -36,7 +39,9 @@ protected BaseDialog() { setDialogIcon(IconTheme.getJabRefImageFX()); setResizable(true); - Globals.getThemeLoader().installCss(getDialogPane().getScene(), Globals.prefs); + EasyBind.wrapNullable(dialogPaneProperty()) + .mapObservable(Node::sceneProperty) + .subscribeToValues(scene -> Globals.getThemeLoader().installCss(scene, Globals.prefs)); } private Optional