Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Swing / AWT / SWT and the fly likes How to use java.awt.Image with HTML? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to use java.awt.Image with HTML?" Watch "How to use java.awt.Image with HTML?" New topic
Author

How to use java.awt.Image with HTML?

Baps Vakkalagadda
Ranch Hand

Joined: May 25, 2004
Posts: 47
Hi All,

I am developing a java swing application in which i have a java.awt.Image object. This Image object is not taken from a file. It is generated some third party java classes.

My problem is how can I display this Image with dynamically generated HTML (using html tags like <IMG src="..."> in Swing components without writing my image to a file.

Can anyone help me? This is urgent.

Thanks (:confused .
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30910
    
158

Baps,
You can't use HTML tags in Swing. You can draw the Image object to the Swing interface if you have it as an object.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Baps Vakkalagadda
Ranch Hand

Joined: May 25, 2004
Posts: 47
Hi Jeanne,

Thank you for your reply.

I know that we can display HTML in Swing using JEditorPane. I have already developed a Swing application to display reports in HTML format. Now my problem is I have picture in java.awt.Image object. I do not know how to display it in JEditorPane with HTML <IMG> tag.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use java.awt.Image with HTML?