menubar does not show up when it's parent is not JFrame
[email protected] Wed, 1 Jun 2005 17:28:34 +0200
| Newsgroups | gmane.comp.embedded.carlsbad-cubes |
|---|---|
| Message-ID | <[email protected]> |
Hello,
when in swixml descriptor menubar has different parent then jframe, it
won't show up.
after looking into source code I found where the problem was. It's in
the Parser.addChild method.
This could be a fix:
***************
*** 784,794 ****
if (component instanceof JMenuBar) {
try {
Method m = parent.getClass().getMethod( "setJMenuBar", new
Class[]{JMenuBar.class} );
! if (m != null) {
! m.invoke( parent, new Object[]{component} );
! } else {
! parent.add(component);
! }
} catch (Exception e) {
// intentionally empty
}
--- 784,792 ----
if (component instanceof JMenuBar) {
try {
Method m = parent.getClass().getMethod( "setJMenuBar", new
Class[]{JMenuBar.class} );
! m.invoke( parent, new Object[]{component} );
! } catch (NoSuchMethodException e) {
! parent.add(component);
} catch (Exception e) {
// intentionally empty
}
Cheers,
Vitali