There are 3 Frames 1st Frame is used to Display the Jlist and Create a New Report and 2nd Frame is used for giving Report Name and Type and 3rd Frame is used to write the report I want to Store the Report Name and Type from 2nd Frame in JList in 1st Frame and when we click on that Report that 3rd Frame should open with the Saved Report
import java.awt.Container;
import javax.swing.JOptionPane;
import java.awt.event.*;
import javax.swing.*;
public class Reports extends JFrame implements ActionListener {
JMenuBar menubar;
JMenu menu1,menu2,menu3,menu4;
JMenuItem menuitem1,menuitem2,menuitem3,menuitem4;
String r_Name,r_Written;
JLabel label;
JTable list;
public Reports(){
super("Reports");
menub();
setSize(500, 400);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(null);
setResizable(false);
setVisible(true);
}
public void menub(){
menubar = new JMenuBar();
menu1 = new JMenu("File");
menuitem1 = new JMenuItem("New");
menuitem1.addActionListener(this);
menu1.add(menuitem1);
menuitem2 = new JMenuItem("Open");
menu1.add(menuitem2);
menuitem2.addActionListener(this);
menu1.addSeparator();
menuitem3 = new JMenuItem("Quit");
menu1.add(menuitem3);
menuitem3.addActionListener(this);
menu2 = new JMenu("Edit");
menubar.add(menu1);
menubar.add(menu2);
setJMenuBar(menubar);
}
public void actionPerformed(ActionEvent e){
if(e.getSource()==menuitem1){
newmenu obj = new newmenu();//Take Report Name and Report Type and then Open up a Frame just like a Notepad
}
else if(e.getSource()==menuitem2){
}
else if(e.getSource()==menuitem3){
System.exit(0);
}
}
public static void main(String args[]){
Reports obj = new Reports();
}
}