首页 > 解决方案 > 如何显示彩色表情符号?

问题描述

我正在 Java-FX 的帮助下开发一个基于窗口的应用程序,我想显示彩色表情符号,但我可以在 Segoe UI Emoji 字体的帮助下显示黑白表情符号,但是如何用这种字体显示彩色表情符号。

package study;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

public class Study extends Application {
    @Override
    public void start(Stage stage) {

        stage.setWidth(500);
        stage.setHeight(500);
        Scene scene = new Scene(new Group());


        VBox root = new VBox();     

        final WebView browser = new WebView();
        final WebEngine webEngine = browser.getEngine();         
        ScrollPane scrollPane = new ScrollPane();
        scrollPane.setContent(browser); 
webEngine.setUserStyleSheetLocation(this.getClass().getClassLoader().
getResource("study/application.css").toString());
 webEngine.loadContent("<html><body>Testing <p>&#128560;</p></body></html>");


        root.getChildren().addAll(scrollPane);
        scene.setRoot(root);

        stage.setScene(scene);
        stage.show();
    }
    public static void main(String[] args) {
        launch(args);

    }
}

标签: javajavafxjavafx-8

解决方案


推荐阅读