I wrote a text editor that saves the text as html.
I'm having no problem with the styles like bold, italic, etc etc, the only problem I'm having is the way it behaves when I press enter.
Instead of creating a new normal line, it creates a extra spaced line. I think it has something to do with the <p>
tag but I'm not sure...
Anyway here's an example of my problem:
import java.awt.BorderLayout;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.text.html.HTMLEditorKit;
public class test extends JFrame {
public static void main(String[] args){
new test().open();
}
private void open() {
setSize(200, 200);
JEditorPane jp = new JEditorPane();
setLayout(new BorderLayout());
add(jp, BorderLayout.CENTER);
jp.setEditorKit(new HTMLEditorKit());
jp.setText("<html><body><p>hey</p><p>Write in here</p></body></html>");
setVisible(true);
}
}
Is there anyway to fix this?