Java - Do a line break in JTextPane without HTML : I've been for a while searching through here and other Java forums. Also googling it, but I haven't found anything that matches my expectations (a line break, basically). I've achieved this:

    public final void messageRoom (String message, Boolean bold, Color color) {
        
        StyledDocument document = new DefaultStyledDocument();
        SimpleAttributeSet attributes = new SimpleAttributeSet();
        
        if(bold) {
            attributes.addAttribute(StyleConstants.CharacterConstants.Bold, Boolean.TRUE);
        }
        attributes.addAttribute(StyleConstants.CharacterConstants.Foreground, color);

        try {
            document.insertString(document.getLength(), message, attributes);
        } catch (BadLocationException ex) {
            System.out.println("ex");
        }
        
        chatArea.setStyledDocument(document);
    }
That allows me to send messages to a chat room I'm creating, how can I make the line break to go to the next line?

Thank you all! (Similar but not equal posts: [First post][1] and [The second one][2])


  [1]: http://stackoverflow.com/questions/23883475/how-to-make-jtextpane-line-break
  [2]: http://stackoverflow.com/questions/27677123/jtextpane-line-break