【发布时间】:2013-08-14 19:24:10
【问题描述】:
首先,我这样设置 JTextPane:
HTMLEditorKit editorKit = new HTMLEditorKit();
HTMLDocument document = (HTMLDocument) editorKit.createDefaultDocument();
JTextPane textPane = new JTextPane();
textPane.setContentType("text/html");
textPane.setDocument(document);
我想在 JtextPane 中设置行距,这是我的想法,但它不起作用:
SimpleAttributeSet aSet = new SimpleAttributeSet();
StyleConstants.setLineSpacing(aSet, 50);
textPane.setParagraphAttributes(aSet, false);
我错了吗?
【问题讨论】:
-
@Aleksei Bulgak 这不是我想回答的。我想要的是在运行时可以设置,并且可以通过textPane.getText()获取HTML代码。
标签: java swing line jtextpane spacing