I figured out the problem after experimenting for hours.
It seems that declaring a static JMenu/JMenuItem in a class like
public class MenuBar {
private static JMenu[] menu = {new JMenu("Edit"), new JMenu("View") };
public static JMenuBar create() {
JMenuBar menuBar = new JMenuBar();
for (JMenu m : menu) {
menuBar.add(m);
}
return menuBar
}
was causing the menubar not to appear. After experimenting a bit, I found out that when running as a JApplet, JApplet runs void init() twice! After modifying my init method all my other code worked.
// I declared an boolean runOnce = false;
public void init() {
if (runOnce) {
new Calculator();
}
runOnce = true
}