How to wrap text around an image in Java? Or how to accomplish CSS float in Java?
I am loading a HTML text with some image tags into JTextPane component.
Example:
text text text text <img src="image.ext"> text text text
Example2: http://www.bbc.co.uk/news/world-us-canada-11882019 (text left, image right something similar)
And i need the im开发者_StackOverflow社区age to be wrapped with a text.
Tried using css... float: right;
(Java doesn't support that feature.. need it..)
Tried all image alignments(left, right etc.) (no luck..)
P.S. PHP programmer..
The Swing tutorial on Using Text Components, shows how to use a JEditorPane to display HTML with an image.
I've implemented something like this (text flow around images and tables) for SoftChalk project (you can see the trial from http://softchalk.com/) but it's not trivial. It required a lot of changes and took significant time to implement and embed this in HTMLEditorKit extension.
I had to extend a lot of views (BlockView extension and completly change layout rows algorithms in all the possible containers - BODY, DIVs, Table cells, list items etc.
精彩评论