How would I go on creating a horizontal line element in JTextPane? Just a rectangle painted probably by View.paint(Graphics), which covers the whole width of the JTextPane, and has an arbitrary height. I also need to be able to dynamically remove these elements.
I’m attempting to approach this by creating a custom editor kit, which has a custom view factory, which returns a “HorizontalLineView” for line elements… but I must admit that this all is a bit over my head! How do I, for example, create the element for this HorizontalLineView? I’ve only used insertString() so far… and I don’t see “addElement” method anywhere… any pointers to right direction would be great.
I’ll sneak in another question: Can anyone recommend a good book that covers JEditorPane/JTextPane in depth?
If HTML content is acceptable, you could do something like: