-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainProgram.java
More file actions
62 lines (54 loc) · 1.52 KB
/
MainProgram.java
File metadata and controls
62 lines (54 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class MainProgram extends ApplicationFrame implements ActionListener
{
JMenuBar mainBar;
JMenu Employees;
JMenuItem addEmployee,editEmployee,searchEmployee,deleteEmployee,exitItem;
MainProgram()
{
mainBar=new JMenuBar();
Employees=new JMenu("Employees");
addEmployee=new JMenuItem("Add Employee");
editEmployee=new JMenuItem("Edit Employee");
searchEmployee=new JMenuItem("Search Employee");
deleteEmployee=new JMenuItem("Delete Employee");
exitItem=new JMenuItem("Exit");
Employees.add(addEmployee);
Employees.add(editEmployee);
Employees.add(searchEmployee);
Employees.add(deleteEmployee);
Employees.addSeparator();
Employees.add(exitItem);
mainBar.add(Employees);
addEmployee.addActionListener(this);
editEmployee.addActionListener(this);
deleteEmployee.addActionListener(this);
searchEmployee.addActionListener(this);
exitItem.addActionListener(this);
setJMenuBar(mainBar);
setBounds(10,10,400,400);
setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
Object obj=e.getSource();
if(obj==addEmployee){
AddEmployee ad=new AddEmployee();
}
if(obj==searchEmployee){
ViewEmployee ad=new ViewEmployee();
}
if(obj==editEmployee){
EditEmployee ad=new EditEmployee();}
if(obj==deleteEmployee){
DeleteEmployee ad=new DeleteEmployee();}
if(obj==exitItem)
dispose();
}
public static void main(String args[])
{
MainProgram mp=new MainProgram();
}
}