I don\'t understand the wrapping behavior in a JTextPane. If I insert a short text, then a JComponent and then again the short text I can see the inserted stuff in one line
That strange behavior seems to happen due to the content type you set. Try removing this line:
textPane.setContentType ( "text/html" );
and you will see that everything works fine after that. I am not sure why it happens - might be either some rendering bug or just an intended behavior.
P.S. I don't think that using Swing components inside text pane (whatever the reason is) is a good option. But that is just my opinion...