gpt4 book ai didi

java - 访问 eclipse 插件中的图像

转载 作者:行者123 更新时间:2023-12-04 07:04:13 25 4
gpt4 key购买 nike

我正在尝试使用设置 Canvas 的背景图像

canvas.setBackgroundImage(image);

我如何设置 图片 *.png 文件 存储在插件的图像子目录中?

像这样的东西:
PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK)

但我想使用我的图像文件而不是共享图像。

最佳答案

对于未在 plugin.xml 中声明的图像,如 this thread :

 public Image createImage(String path) {
Image image = getImageRegistry().get(path);
if (image == null) {
getImageRegistry().put(path, AbstractUIPlugin.
imageDescriptorFromPlugin(ID, path));
image = getImageRegistry().get(path);
}
return image;
}

(类似于“ FAQ How do I create an image registry for my plug-in?”)

另见 User interface resources用于访问插件中声明的资源。

关于java - 访问 eclipse 插件中的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1362011/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com