diff options
Diffstat (limited to 'gnu/java/awt/peer/qt/QtFramePeer.java')
-rw-r--r-- | gnu/java/awt/peer/qt/QtFramePeer.java | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/gnu/java/awt/peer/qt/QtFramePeer.java b/gnu/java/awt/peer/qt/QtFramePeer.java index 56f6132e5..4898f598e 100644 --- a/gnu/java/awt/peer/qt/QtFramePeer.java +++ b/gnu/java/awt/peer/qt/QtFramePeer.java @@ -61,6 +61,8 @@ public class QtFramePeer extends QtWindowPeer implements FramePeer { super.setup(); setTitle( ((Frame)owner).getTitle() ); + if( ((Frame)owner).getMenuBar() != null ) + setMenuBar( ((Frame)owner).getMenuBar() ); } private native void setIcon(QtImage image); @@ -86,14 +88,10 @@ public class QtFramePeer extends QtWindowPeer implements FramePeer public Insets getInsets() { - int mbHeight; - if( ((Frame)owner).getMenuBar() != null ) - mbHeight = menuBarHeight(); - else - mbHeight = 0; + int mbHeight = ( ((Frame)owner).getMenuBar() != null ) ? + menuBarHeight() : 0; - // FIXME : more accurate? - return new Insets(0, 0, mbHeight, 0); + return new Insets(mbHeight, 0, 0, 0); } public void setIconImage(Image im) @@ -110,14 +108,18 @@ public class QtFramePeer extends QtWindowPeer implements FramePeer public void setMenuBar(MenuBar mb) { - if( mb != null) + if( mb != null ) { QtMenuBarPeer mbpeer = (QtMenuBarPeer)mb.getPeer(); - if( mbpeer != null) + if( mbpeer == null ) { - mbpeer.addMenus(); - setMenu( mbpeer ); + mb.addNotify(); + mbpeer = (QtMenuBarPeer)mb.getPeer(); + if( mbpeer == null ) + throw new IllegalStateException("No menu bar peer."); } + mbpeer.addMenus(); + setMenu( mbpeer ); } else setMenu( null ); |