Mike Rinehart
Mike Rinehart

Reputation: 445

How to display image in JEditorPane from local filesystem?

I'm trying to display an image in a JEditorPane in a Java Swing window. The user uses a JFileChooser to find the absolute path of an image on their computer, and then that absolute path is embedded into an HTML <img> tag, which is then set in a JEditorPane. For some reason, the image will just not show in the JEditorPane, and I can't figure out why. I've Googled around and found various solutions, but none have worked. Can someone please help me?

Upvotes: 1

Views: 1488

Answers (1)

StanislavL
StanislavL

Reputation: 57421

You can place the images in the imageCache of Document like it's described here http://java-sl.com/tip_local_images.html

Upvotes: 2

Related Questions