Copy/paste from JTextPane to others application without text formatting support
I have a JTextPane with contentType set to "text/html". The content of the JTextPane is formatted with html. My lines are formatted like this: "<p>hello</p>\n".
I'm able to copy data from my JTextPane to an application that support text formatting like OpenOffice (I get my text with formatting like color and lines breaks), but when I try to paste my data to an application that doesn't support text formatting (like gedit), I lose my l开发者_开发技巧ines breaks (I get all the lines merged into one single line).
Any idea how to be able to correctly paste my text with lines breaks to application that doesn't support text formatting?
Thanks!
Forget it... I found that my html formatting was bad. It's working now with a correct formatting. I don't even need a \n
after the <p>
tags, swing
convert it to line break automatically.
精彩评论