行间距 HTMLEditor JavaFx
Line spacing HTMLEditor JavaFx
我想用 css 规则调整 JavaFx 中 HTMLEditor 的行高,但找不到规则的名称。
我尝试了 -fx-line-height
和其他一些,但其中 none 有效。甚至可能,还是 HTMLEditor 太受限制了?
HTML编辑器编辑HTML,需要指定line-height in HTML based CSS(不是JavaFXCSS)。
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);
}
}
我想用 css 规则调整 JavaFx 中 HTMLEditor 的行高,但找不到规则的名称。
我尝试了 -fx-line-height
和其他一些,但其中 none 有效。甚至可能,还是 HTMLEditor 太受限制了?
HTML编辑器编辑HTML,需要指定line-height in HTML based CSS(不是JavaFXCSS)。
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);
}
}