简体   繁体   English

eclipse插件:将图像添加到浏览器

[英]eclipse plugin: add image to browser

I have created an Eclipse plugin which displays a browser with a URL as follows: 我创建了一个Eclipse插件,该插件显示带有URL的浏览器,如下所示:

browser.setBounds(0, 0, 100, 100);
browser.setUrl("https://www.stackoverflow.com/");

Also I am able to get the animated image from the bundle as follows: 我也可以从捆绑包中获取动画图像,如下所示:

Image image = ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path("icons/sample.gif"), null)).createImage();

How could I add the Image to the browser on run time execution? 如何在运行时执行时将映像添加到浏览器

Since you're setting the Browser widget to display a URL, the widget will display the contents of that URL. 由于您将浏览器窗口小部件设置为显示URL,因此窗口小部件将显示该URL的内容。

If you want to display your own content, you'll have to use the setText() method. 如果要显示自己的内容,则必须使用setText()方法。

Perhaps you can create html that includes the URL you want in an IFRAME and compose the rest of the html with your own content? 也许您可以创建包含IFRAME中想要的URL的html,然后用您自己的内容组成html的其余部分?

As for the image, I'm sure there are ways to include the image in the constructed HTML ... or you can base64 encode the data and include it in the constructed HTML. 至于图像,我敢肯定有几种方法可以将图像包括在构造的HTML中……或者您可以对数据进行base64编码,然后将其包括在构造的HTML中。 See Can I embed a .png image into an html page? 请参阅我可以将.png图像嵌入html页面吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM