Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Relative Image Path Problem in insertHTML of HTMLEditorKit  RSS feed

Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using insertHTML method of HTMLEditorKit for inserting html text inside texteditorpane . In HTMLDocument of texteditor pane I want to display images too . For images I am using relative part of the respective image in src attribute of <img. But its not finding the path of the image & hence its not loaded.

I am doing

insertHTML("hi der dude<img src='./emoticons/images/smile.gif' alt=' ' >");

On top of that if I use classloader.getresource(imagepath) , the url I get works .
But it doesnt fit in my requirement ,THATS THE BIG CONSTRAINT.

I have gone through the setBase to set the base URL of document but couldnt get on top of that to get the pbm solved.

Please suggest some solution.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!