How would I go about toggling text wrap on a JTextpane
?
public JFrame mainjFrame = new JFrame("Text Editor");
public JTextPane mainJTextPane = new JTextPane();
public JScrollPane mainJScrollPane = new JScrollPane(mainJTextPane);
mainjFrame.add(mainJScrollPane);
I don't know any other way for what you are looking for..
But this is working well.
( Based on camickr's answer.. +1 )
See No Wrap Text Pane.
Edit:
Well, if you want to toggle the behaviour, then you would also need to toggle the getScrollableTracksViewportWidth() value. See Scrollable Panel. You should be able to toggle between FIT and STRETCH.