简体   繁体   English

在SWT浏览器组件中使用图像

[英]Using Images In SWT Browser Component

Whats the best way of using images in SWT Browser component. 什么是在SWT Browser组件中使用图像的最佳方式。 Currently i stream the images to temp folder and use their location for displaying them. 目前我将图像流式传输到临时文件夹并使用它们的位置来显示它们。 Is there any better way of using these images in the SWT Browser component, particulary images from the platform plugins. 有没有更好的方法在SWT浏览器组件中使用这些图像,特别是来自平台插件的图像。

Best Regards, Keshav 最诚挚的问候,凯沙夫

If your plug-in is directory-based - rather than jar-based - you can use the files in the plug-in directly. 如果您的插件是基于目录的 - 而不是基于jar的 - 您可以直接使用插件中的文件。 The are several ways to find the file name of an resource entry of a bundle - I prefer FileLocator.toFileURL(URL) which converts an URL on the format platform:/<plugin>/<path> to a file:<filename> ... exactly what you need. 有几种方法可以找到bundle的资源条目的文件名 - 我更喜欢FileLocator.toFileURL(URL) ,它将格式platform:/<plugin>/<path>上的URL platform:/<plugin>/<path>转换为file:<filename> 。 ..正是你需要的。

Convert them to a DataURI and insert them into the HTML directly. 将它们转换为DataURI并直接将它们插入HTML。

http://en.wikipedia.org/wiki/Data_URI_scheme http://en.wikipedia.org/wiki/Data_URI_scheme

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

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