Wrap long words in JTextPane (Java 7)
问题 In all versions of Java up to 6, the default behaviour of a JTextPane put inside a JScrollPane was: wrap lines at word boundaries if possible. If not, then wrap them anyway. In JDK 7, the default behaviour seems to be: wrap lines at word boundaries if possible. If not, just expand the width of the JTextPane (never wrap long words). It is easy to reproduce this, here is a SSCCE: public class WrappingTest extends JFrame { public static void main ( String[] args ) { new WrappingTest(); } public