JMenu issue with Gnome's native look and feel
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.
精彩评论