Set font and document before changing line spacing:
private void changeLineSpacing(JTextPane pane) {
SimpleAttributeSet set = new SimpleAttributeSet(pane.getParagraphAttributes());
StyleConstants.setLineSpacing(set, 0.5F);
pane.setParagraphAttributes(set, true);
}