Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: Help using Flowlayout

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help using Flowlayout

    Hi,
    Just signed up, have a problem, I am using a flow layout and a JMenu for a program I have created. But I cannot find out how to connect a new window to the JMenu, I have my program set so that it loads a Menu and at the top you have the selection to swap to a different Menu but I do not know how to do this.
    Here is a snippet of my code
    I just would like to know if anyone could help me connect the menu on the option to a new window.

    Thanks
    //Creates Menu
    		JMenuBar menuBar = new JMenuBar();//Creates a new Menu
    		JMenu menu = new JMenu("Open Applications");//Add Name of Menu
     
    		//Adds a Menu Item to the toolbar
    	    JMenuItem Doors = new JMenuItem("Operate Doors");
    		JMenuItem Lights = new JMenuItem("Turn Lights On/Off");
     
    		menu.add(Doors);
    		menuBar.add(menu);
     
    		menu.add(Doors);//Adds a new item Option to the menu
    		menu.add(Lights);//Adds a open item Option to the menu
    		menuBar.add(menu);//Adds a an Add Option to the menu
    		setJMenuBar(menuBar);//Adds a menu to the window
     
    		setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);//Closes whole program on exit
    		setSize(750,350);//Sets the Size of the window
    		setVisible(true);
    Last edited by Freaky Chris; April 6th, 2010 at 05:22 AM.