I am trying to add a menubar to a frame, when i execute the following program on Windows platform then i get the correct output where as the menubar does not appear in the frame if i execute it on Mac OS!!
import java.awt.*; import java.awt.event.*; public class menuDemo extends Frame implements WindowListener{ MenuBar mb; Menu m1,m2,m3; MenuItem mi1,mi2,mi3,mi4; menuDemo(){ setLayout(new FlowLayout()); setSize(500,500); mb=new MenuBar(); m1=new Menu("File"); m2=new Menu("New"); m3=new Menu("Save"); mi1=new MenuItem("one"); mi2=new MenuItem("two"); mi3=new MenuItem("three"); mi4=new MenuItem("Four"); Button b=new Button("hell"); add(b); m1.add(mi1); m1.add(mi2); m2.add(mi3); m3.add(mi4); mb.add(m1); mb.add(m2); mb.add(m3); setMenuBar(mb); addWindowListener(this); setVisible(true); } public static void main(String ar[]){ new menuDemo(); } public void windowClosed(WindowEvent we){} public void windowClosing(WindowEvent we){ dispose(); } public void windowOpened(WindowEvent we){} public void windowActivated(WindowEvent we){} public void windowDeactivated(WindowEvent we){} public void windowIconified(WindowEvent we){} public void windowDeiconified(WindowEvent we){} }