import javafx.application.Application;
import javafx.application.Platform;
import javafx.embed.swing.SwingNode;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.stage.Stage;

import javax.swing.JLabel;
import javax.swing.SwingUtilities;

public class BlurrySwingNode extends Application {
    public static void main(String[] args) {
        Application.launch(args);
    }

    @Override
    public void start(Stage stage) {
        stage.setTitle("Blurry SwingNode");
        SwingUtilities.invokeLater(() -> {

            final float size = 120f;
            final Font font = new Font("Arial", size);
	    System.setProperty("sun.java2d.uiScale", "1.25");

            // FX label
            final Label fxLabel = new Label("JAVAFX LABEL");
            fxLabel.setFont(font);

            // Swing label in a SwingNode
            final JLabel swingLabel = new JLabel("SWING LABEL");
            swingLabel.setBackground(java.awt.Color.WHITE);
            swingLabel.setOpaque(true);
            swingLabel.setFont(swingLabel.getFont().deriveFont(java.awt.Font.PLAIN, size));
            final SwingNode swingLabelNode = new SwingNode();
            swingLabelNode.setContent(swingLabel);

            final VBox root = new VBox();
            final String bgStyle = "-fx-background-color: white";
            root.getChildren().addAll(fxLabel, swingLabelNode);
            root.setStyle(bgStyle);

            Platform.runLater(() -> {
                final Scene scene = new Scene(root);
                stage.setScene(scene);
                stage.show();
            });
	    Object lwFrame = com.sun.javafx.embed.swing.SwingNodeHelper.getLightweightFrame(swingLabelNode);
	    System.out.println(((sun.swing.JLightweightFrame)lwFrame).getScaleFactorX());
        });
    }
}
