Skip to content

Commit c9c3c34

Browse files
committed
passes JMenuBar height to applet
1 parent e344808 commit c9c3c34

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSMenuBarUI.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
import javax.swing.BoxLayout;
4242
import javax.swing.InputMap;
43+
import javax.swing.JApplet;
4344
import javax.swing.JComponent;
4445
import javax.swing.JMenu;
4546
import javax.swing.JMenuBar;
@@ -111,7 +112,16 @@ public void propertyChange(PropertyChangeEvent e) {
111112
@Override
112113
protected int getContainerHeight() {
113114
Insets m = menuBar.getInsets();
114-
return height = getFont().getFontMetrics().getHeight() + m.top + m.bottom;
115+
height = getFont().getFontMetrics().getHeight() + m.top + m.bottom;
116+
return height;
117+
}
118+
119+
@Override
120+
public void setVisible(boolean b) {
121+
super.setVisible(b);
122+
Component top = menuBar.getTopLevelAncestor();
123+
if ( top instanceof JApplet)
124+
((JSAppletUI)((JApplet) top).getUI()).checkMenuBar(b ? height : 0);
115125
}
116126

117127
@Override

0 commit comments

Comments
 (0)