的JTextPane HTML图像整合
问题描述:
我有一个JTextPane中,我做到这一点:的JTextPane HTML图像整合
HTMLEditorKit kit = new HTMLEditorKit();
HTMLDocument doc = new HTMLDocument();`
this.setEditorKit(kit);
this.setDocument(doc);
然后我做的:
profilePictureSrc = "http://ola/profilePicture1.jpg";
chatContent ="<img src=\"" + profilePictureSrc + "\">";
凡profilePictureSrc是一个URL对象。
它的工作原理,但我必须用一个字符串代替URL(Java Hashtable put method slow down my application)
我该怎么办呢?我必须把图片文件的地方,并使用相对路径,以达到他们?非常感谢您对您的想法
问候
答
您可以链接对象转换为字符串。
String urlstring = myurl.toString();