It seems my current JTextArea instance is having line-spcing about 1 or 1.5. Can anybody tell me how to change the line-spacing in JTextArea instance?
Doing a google search suggests you should be using JTextPane
and in particular the setParagraphAttributes
located here.
The way to get the AttributeSet
you need is as follows:
MutableAttributeSet set = new SimpleAttributeSet();
StyleConstants.setLineSpacing(set, /* your spacing */);
Now just pass in set
to the setParagraphAttributes
method.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With