【发布时间】:2014-12-03 22:35:53
【问题描述】:
我有一个在 OSGI 中运行的 RAP 应用程序。我想显示一些图像。
很遗憾,我的浏览器不会显示我想要的文件的图像。 我用一个非常小的 gif 对其进行了测试,结果显示。但只有一个。 当我用另一个交换它时,它仍然无法工作。 确切的问题是,如果我在图片周围放置边框,我可以看到边框。 但是边界上什么都没有。
这几天我已经尝试了很多不同的方法,但我想我被困在了这一点上。
我试过这样做:
Image image3 = loadImage( parent.getDisplay(), "icons/test-100x50.png" );
Label l3 = new Label( parent, SWT.BORDER );
l3.setImage( image3 );
像这样:
public static Image loadImage( Display display, String name ) {
Image result = null;
InputStream stream = BasicEntryPoint.class.getClassLoader().getResourceAsStream( name );
if( stream != null ) {
try {
result = new Image( display, stream );
} finally {
try {
stream.close();
} catch( IOException unexpected ) {
throw new RuntimeException( "Failed to close image input stream", unexpected );
}
}
}
return result;
}
我什至用 MarkUps 尝试过
但我找不到我缺少的东西。
图像位于插件中名为icons 的文件夹中,我已在build.properties 文件中选择了icons 文件夹。
仅供参考:我看到了带有蓝色标题的 RAP 演示,并像这样实现了我的图片。 起初它可以工作,但是当我将它作为 OSGI 应用程序启动时,我只能看到命令 SWT.BORDER 的边框
【问题讨论】:
标签: eclipse image osgi eclipse-rap