Let me try to explain this...
I have a JEditPane. I also have a string of html code.
* the html is shortened.
What I want to do is use setText() to set the code of the edit pane.
If I do this, the picture doesnt show, it shows the small broken picture icon.
However, if I load the page via setPage() with a file, the picture shows. After I use setPage() I can then use setText() and the picture shows.
I'm guessing that something is being initialized in the edit pane when setPage() is called. Because after setPage(), the setText() calls work fine.
I would like to be able to do this without having to call setPage() first.
Heres a small example...
String html = "<html><body><img src="images/mypic.jpg"></body></html>";
editPane.setText(html); // <-- Does not work... picture does not show.
editPane.setPage("file:///whatever.html"); // <--- Works, Picture shows.
editPane.setText("whatever"); // Set it to random text.
editPane.setText(html); // <-- Works, picture shows. Because setPage() was called?
Edit: This question was also posted at coderanch. I cant post a link... not enough posts.
Try to use URL with absolute path for the image.