I can\'t squeeze together the lines in a Java JTextPane
if I set the content-type to text/html
. I would like them as close together as they are when th
Solved! If I use Courier New
instead of monospace
for the font-family
, the line spacing is exactly the same as in the text-plain
version under Windows. Thanks everyone!
This may be platform dependent:
Try something like this
StyledDocument doc= textPane.getStyledDocument();
MutableAttributeSet attr= new SimpleAttributeSet();
StyleConstants.setLineSpacing(attr, -0.2f); //NOTE: negative value.
Looks like you are running windows. What version of JDK/JRE is in use?