How to set the line spacing in a JtextPane?

后端 未结 3 1121
予麋鹿
予麋鹿 2020-12-20 06:27

First of all, i set the JTextPane like this:

HTMLEditorKit editorKit = new HTMLEditorKit();
HTMLDocument document = (HTMLDocument) editorKit.createDefaultDoc         


        
3条回答
  •  [愿得一人]
    2020-12-20 06:35

    When you call textPane.setParagraphAttributes(aSet, false); it tries to apply line spacing to selection but nothing is selected

    Call it another way

    document.setParagraphAttributes(0, document.getLength(), attr, replace);
    

提交回复
热议问题