java – Eclipse MenuManager:获取Image的ImageDescriptor?
发布时间:2020-05-25 01:02:49 所属栏目:Java 来源:互联网
导读:我不能让这个工作,所以我认为在这里张贴可能是一个明智的想法… 我在SWT中有一个上下文菜单(实际上它是一个 Eclipse插件).这是一个级联菜单,所以当你将鼠标悬停在某个条目上时它会立即扩展… 我的问题是,我想在菜单上附上一个小图标,但我很挣扎! 码: …. ma
|
我不能让这个工作,所以我认为在这里张贴可能是一个明智的想法…
我的问题是,我想在菜单上附上一个小图标,但我很挣扎! 码: manager.add(new Separator());
// icon for the "change color" menu
ImageDescriptor icon = ImageDescriptor.createFromFile(null,"icons/palette_brush.png");
// submenu
MenuManager colorMenu = new MenuManager("Menu",icon,null);
// Actions
colorMenu.add(someAction);
// add the action to the submenu
manager.add(colorMenu);
....
我的问题是,可以使用2个参数(无附加图像)或3(带附加图像)调用新的MenuManager.图像应作为ImageDescriptor传递. 也许这是一个愚蠢的错误 – 但我无法从图像文件中获取ImageDescriptor.我有一个* .png图标可供使用,但我很难将其合并. 最好的祝福! MenuManager文档: 解决方法Bundle bundle = Platform.getBundle(pluginId); URL fullPathString = BundleUtility.find(bundle,"icons/palette_brush.png"); ImageDescriptor.createFromURL(fullPathString); pluginId是您放置图标的插件的ID. (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
热点阅读
