• Post Reply Bookmark Topic Watch Topic
  • New Topic

Display of image in JEditorPane  RSS feed

 
merwin pinto
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
i am having a problem displaying images on the JEditorPane ....it does not
recognize the <img src''> tag ..
.does any one have a solution to this
thank you
 
sasi kala
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

This question belows to swings, from the next time post
this in "Swing / AWT / SWT / JFace".

To display any image or to set html file to JEdiorpane. it needs the path in a specific way "it should start with a protocal and need full path".

There are two ways to do this
1) String url = "file://c:/urdir/test.jpg";
editor.setText("<html><img src="+url+"></img></html>");

2) java.net.URL url = getClass().getResource("imagename");
System.out.println(url);
editor.setText("<html><img src="+url+"></img></html>");

All The Best
[ March 22, 2005: Message edited by: sasi kala ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!