kvarnerexpress 0 Report post Posted September 18, 2005 I wrote this program which should have a menu bar. However, it does not appear.heres the codeCode: import java.awt.*;import java.awt.event.*;import javax.swing.*;public class Desktop extends JFrame { public static void main(String[] args) { new Desktop(); } public Desktop() { super("Multiple Document Interface"); WindowUtilities.setNativeLookAndFeel(); addWindowListener(new ExitListener()); Container content = getContentPane(); //menu bar components JMenuBar menu; JMenu file; JMenuItem newWindow; JMenuItem close; menu = new JMenuBar(); file = new JMenu("File"); newWindow = new JMenuItem("New Window"); close = new JMenuItem("Close"); menu.add(file); file.add(newWindow); file.add(close); menu.setVisible(true); content.setBackground(Color.white); JDesktopPane desktop = new JDesktopPane(); desktop.setBackground(Color.white); desktop.add(menu); content.add(desktop, BorderLayout.CENTER); setSize(600,600); for(int i=1; i<6; i++) { JInternalFrame frame = new JInternalFrame(("Note " + i),true, true, true, true); frame.setLocation(i*50+10, i*50+10); frame.setSize(200, 150); frame.setBackground(Color.white); desktop.add(frame); frame.setVisible(true); frame.moveToFront(); } setVisible(true); }} Share this post Link to post Share on other sites
dul 0 Report post Posted October 19, 2005 Hi,I'm very sorry. Buy the any Java beginner book. Writing on the forum is wasting you time. That is simple stuf. Buy book and start study. Come on... Share this post Link to post Share on other sites
leiaah 0 Report post Posted October 30, 2005 hey there! I think I get the problem here. You must have forgotten to set the menu bar. This might help: menu.add(file);setJMenuBar(menu);let me know if it worked. Share this post Link to post Share on other sites