开发者

JMenu issue with Gnome's native look and feel

开发者 https://www.devze.com 2022-12-28 14:42 出处:网络
I stumbled on a very odd problem while trying to set up a JMenuBar with the native look and feel of Gnome. Here is a screenshot:

I stumbled on a very odd problem while trying to set up a JMenuBar with the native look and feel of Gnome. Here is a screenshot: http://img23.imageshack.us/i/issuel.png/

It has to say File there but it gets cut out.

http://pastebin.com/CjFhmxcf

http://pastebin.com/gwB3vnC3

Any, help i开发者_运维技巧s appreciated!


Looks like you are adding icon after the menu itself has been attached to the frame. You should do all menu operations before displaying it, or call

menuBar.validate();
menuBar.paint();

after all menu decorations are done.

I have something like this

JMenu mFoo = new JMenu("Foo");
mFoo.setIcon(new ImageIcon("icon.png"));
JMenuBar menuBar = new JMenuBar();
menuBar.add(mFoo);
setJMenuBar(menuBar);

in my JFrame working perfectly, also with GTK look-and-feel.

0

精彩评论

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