开发者

SWT: MenuItem cannot setImage in Linux

开发者 https://www.devze.com 2023-02-07 18:11 出处:网络
Developing an application using SWT to work in both Linux and Windows. I created a Menu with a single MenuItem that has an image.The image in the menuItem shows on windows but not on linux.Is this ex

Developing an application using SWT to work in both Linux and Windows.

I created a Menu with a single MenuItem that has an image. The image in the menuItem shows on windows but not on linux. Is this expected behavior for Linux? Any workarounds?

Menu menu = new Menu(shell, SWT.POP_UP);
MenuItem item = new MenuItem开发者_开发问答(menu, SWT.PUSH);
item.setImage((ResourceManager.getPluginImage(MyPlugin.PLUGIN_ID, "icons/myimage.gif")));
item.setText("TEXT");


It's a GTK problem that can be fixed by tweaking settings - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=293720

I run ubuntu (lucid) and fixed this through running gconf-editor from the command line, navigating to desktop->gnome->interface and ticking "menus_have_icons"

0

精彩评论

暂无评论...
验证码 换一张
取 消