How can I get the JTextPane to create a new line when the user types in something and it reaches the end of the screen/frame? Here is what I have:
JFrame frame = new JFrame("Frame");
JTextPane pane= new JTextPane ();
JPanel panel = new JPanel(new BorderLayout());
panel.add(pane);
JScrollPane scrollBar = new JScrollPane(panel);
scrollBar.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
frame.add(scrollBar, BorderLayout.CENTER);
Please note this is NOT for some fixed string in the JTextPane, meaning that the pane is blank by default and the text is added by user input. When the user is typing something and the word has reached the end of the screen, the text should continue on a new line, rather than continuing on the same line...