I'm trying to get JTextPane to word-wrap. I've searched this site and across the Internet and it seems that JTextPane is supposed to word-wrap by default- most trouble people have is with disabling the wrap or getting the wrap to work inside a JScrollPane. I've tried various combinations of TextPanes, ScrollPanes and JPanels, to no avail. Below is the simplest possible code tested that still has the problem (no wrap).
public class Looseleaf extends JFrame{
public Looseleaf(){
this.setSize(200,200);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTextPane txtPane = new JTextPane();
this.add(txtPane);
this.setVisible(true);
}
}