hey i am currently working with java to do assignment. i dont know how to call form from menubar to open new form,,, so anyone can help......

Recommended Answers

All 3 Replies

What part of it do you need help with...
how to respond to a menu selection?
how to open a new form?
something else...?

What part of it do you need help with...
how to respond to a menu selection?
how to open a new form?
something else...?

oh i have made a form using this code

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mainmenu;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
 *
 * @author new
 */
public class MainMenu extends JFrame {
    public MainMenu()
    {
        super("Main menu");
        JMenuBar menuBar = new JMenuBar();
        setJMenuBar(menuBar);
        
        JMenu file = new JMenu("File");
        JMenu about = new JMenu("About");
        
        menuBar.add(file);
        menuBar.add(about);
        
        JMenuItem detail = new JMenuItem("Enter details");
        JMenu query = new JMenu("Query");
        JMenuItem exit = new JMenuItem("Exit");
        
        file.add(detail);
        file.add(query);
        file.addSeparator();
        file.add(exit);
        
        JMenuItem detailofallpieces = new JMenuItem("Details Of All pieces");
        JMenuItem showlocation = new JMenuItem("Show Location Of All pieces");
        
        query.add(detailofallpieces);
        query.add(showlocation);
        
        
            
        
    }
        
        
      
    
              
    

        public static void main(String[] args) {
        JFrame f= new MainMenu();
        f.setVisible(true);
        f.setSize(800,700);
        
                
    }
}

now i want to add form named detailedform by clicking sub menu items adddetailed....
please help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.