簡體   English   中英

行距HTMLEditor JavaFx

[英]Line spacing HTMLEditor JavaFx

我想使用css規則調整JavaFx中HTMLEditor的行高,但找不到該規則的名稱。 我嘗試了-fx-line-height和其他一些功能,但是沒有一個起作用。 甚至有可能,還是HTMLEditor太受限制了?

HTML編輯器編輯HTML,您需要在基於HTML的CSS (不是JavaFX CSS)中指定行高

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.web.HTMLEditor;
import javafx.stage.Stage;

public class SpacedOut extends Application {

    private static final String HTML_TEXT =
            "<p style=\"line-height:1.5\">\n" +
            "    <span style=\"font-size:12pt\">The quick brown fox jumps over the lazy dog.</span><br />\n" +
            "    <span style=\"font-size:24pt\">The quick brown fox jumps over the lazy dog.</span>\n" +
            "</p>";

    @Override
    public void start(Stage stage) throws Exception{
        HTMLEditor editor = new HTMLEditor();
        editor.setHtmlText(HTML_TEXT);

        Scene scene = new Scene(new Pane(editor));
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM