看来我当前的 JTextArea 实例的行间距约为 1 或 1.5。谁能告诉我如何更改 JTextArea 实例中的行距?
6246 次
进行谷歌搜索表明您应该使用JTextPane,尤其是setParagraphAttributes位于此处的。
获得AttributeSet所需的方法如下:
MutableAttributeSet set = new SimpleAttributeSet();
StyleConstants.setLineSpacing(set, /* your spacing */);
现在只需传入set该setParagraphAttributes方法。
希望这可以帮助。