-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddEmployee.java
178 lines (130 loc) · 6.34 KB
/
AddEmployee.java
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
package hotel.management.system;
import java.awt.EventQueue;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
public class AddEmployee extends JFrame{ //Third Frame
JTextField textField,textField_1,textField_2,textField_3,textField_4,textField_5,textField_6;
JComboBox c1;
public AddEmployee(){
getContentPane().setForeground(Color.BLUE);
getContentPane().setBackground(Color.WHITE);
setTitle("ADD EMPLOYEE DETAILS");
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
setSize(778,486);
getContentPane().setLayout(null);
JLabel Passportno = new JLabel("NAME");
Passportno.setFont(new Font("Tahoma", Font.PLAIN, 17));
Passportno.setBounds(60, 30, 150, 27);
add(Passportno);
textField = new JTextField();
textField.setBounds(200, 30, 150, 27);
add(textField);
JButton Next = new JButton("SAVE");
Next.setBounds(200, 420, 150, 30);
Next.setBackground(Color.BLACK);
Next.setForeground(Color.WHITE);
add(Next);
JLabel Pnrno = new JLabel("AGE");
Pnrno.setFont(new Font("Tahoma", Font.PLAIN, 17));
Pnrno.setBounds(60, 80, 150, 27);
add(Pnrno);
textField_1 = new JTextField();
textField_1.setBounds(200, 80, 150, 27);
add(textField_1);
JLabel Gender = new JLabel("GENDER");
Gender.setFont(new Font("Tahoma", Font.PLAIN, 17));
Gender.setBounds(60, 120, 150, 27);
add(Gender);
JRadioButton NewRadioButton = new JRadioButton("MALE");
NewRadioButton.setBackground(Color.WHITE);
NewRadioButton.setBounds(200, 120, 70, 27);
add(NewRadioButton);
JRadioButton Female = new JRadioButton("FEMALE");
Female.setBackground(Color.WHITE);
Female.setBounds(280, 120, 70, 27);
add(Female);
JLabel Address = new JLabel("JOB");
Address.setFont(new Font("Tahoma", Font.PLAIN, 17));
Address.setBounds(60, 170, 150, 27);
add(Address);
String course[] = {"Front Desk Clerks","Porters","Housekeeping","Kitchen Staff","Room Service","Waiter/Waitress","Manager","Accountant","Chef"};
c1 = new JComboBox(course);
c1.setBackground(Color.WHITE);
c1.setBounds(200,170,150,30);
add(c1);
JLabel Nationality = new JLabel("SALARY");
Nationality.setFont(new Font("Tahoma", Font.PLAIN, 17));
Nationality.setBounds(60, 220, 150, 27);
add(Nationality);
textField_3 = new JTextField();
textField_3.setBounds(200, 220, 150, 27);
add(textField_3);
JLabel Name = new JLabel("PHONE");
Name.setFont(new Font("Tahoma", Font.PLAIN, 17));
Name.setBounds(60, 270, 150, 27);
add(Name);
textField_4 = new JTextField();
textField_4.setBounds(200, 270, 150, 27);
add(textField_4);
JLabel Phno = new JLabel("AADHAR");
Phno.setFont(new Font("Tahoma", Font.PLAIN, 17));
Phno.setBounds(60, 320, 150, 27);
add(Phno);
textField_5 = new JTextField();
textField_5.setBounds(200, 320, 150, 27);
add(textField_5);
JLabel email = new JLabel("EMAIL");
email.setFont(new Font("Tahoma", Font.PLAIN, 17));
email.setBounds(60, 370, 150, 27);
add(email);
textField_6 = new JTextField();
textField_6.setBounds(200, 370, 150, 27);
add(textField_6);
setVisible(true);
JLabel AddPassengers = new JLabel("ADD EMPLOYEE DETAILS");
AddPassengers.setForeground(Color.BLUE);
AddPassengers.setFont(new Font("Tahoma", Font.PLAIN, 31));
AddPassengers.setBounds(450, 24, 442, 35);
add(AddPassengers);
ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/tenth.jpg"));
Image i3 = i1.getImage().getScaledInstance(500, 500,Image.SCALE_DEFAULT);
ImageIcon i2 = new ImageIcon(i3);
JLabel image = new JLabel(i2);
image.setBounds(410,80,480,410);
add(image);
Next.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
String name = textField.getText();
String age = textField_1.getText();
String salary = textField_3.getText();
String phone = textField_4.getText();
String aadhar = textField_5.getText();
String email = textField_6.getText();
String gender = null;
if(NewRadioButton.isSelected()){
gender = "male";
}else if(Female.isSelected()){
gender = "female";
}
String s6 = (String)c1.getSelectedItem();
try {
conn c = new conn();
String str = "INSERT INTO employee values( '"+name+"', '"+age+"', '"+gender+"','"+s6+"', '"+salary+"', '"+phone+"','"+aadhar+"', '"+email+"')";
c.s.executeUpdate(str);
JOptionPane.showMessageDialog(null,"Employee Added");
setVisible(false);
} catch (Exception e) {
System.out.println(e);
}
}
});
setSize(900,600);
setVisible(true);
setLocation(530,200);
}
public static void main(String[] args){
new AddEmployee();
}
}