-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmployee.java
128 lines (110 loc) · 3.87 KB
/
Employee.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
package hotel.management.system;
import java.awt.BorderLayout;
import java.awt.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import net.proteanit.sql.DbUtils;
import javax.swing.JTable;
import java.sql.*;
import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Employee extends JFrame {
Connection conn = null;
private JPanel contentPane;
private JTable table;
private JLabel lblNewLabel;
private JLabel lblJob;
private JLabel lblName;
private JLabel lblDepartment;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Employee frame = new Employee();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public void close()
{
this.dispose();
}
/**
* Create the frame.
* @throws SQLException
*/
public Employee() throws SQLException {
//conn = Javaconnect.getDBConnection();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(430, 200, 1000, 600);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
table = new JTable();
table.setBounds(0, 34, 1000, 450);
contentPane.add(table);
JButton btnLoadData = new JButton("Load Data");
btnLoadData.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try{
conn c = new conn();
String displayCustomersql = "select * from Employee";
ResultSet rs = c.s.executeQuery(displayCustomersql);
table.setModel(DbUtils.resultSetToTableModel(rs));
}
catch(Exception e1){
e1.printStackTrace();
}
}
});
btnLoadData.setBounds(350, 500, 120, 30);
btnLoadData.setBackground(Color.BLACK);
btnLoadData.setForeground(Color.WHITE);
contentPane.add(btnLoadData);
JButton btnExit = new JButton("Back");
btnExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new Reception().setVisible(true);
setVisible(false);
}
});
btnExit.setBounds(510, 500, 120, 30);
btnExit.setBackground(Color.BLACK);
btnExit.setForeground(Color.WHITE);
contentPane.add(btnExit);
lblNewLabel = new JLabel("Name");
lblNewLabel.setBounds(41, 11, 46, 14);
contentPane.add(lblNewLabel);
lblJob = new JLabel("Age");
lblJob.setBounds(159, 11, 46, 14);
contentPane.add(lblJob);
lblName = new JLabel("Gender");
lblName.setBounds(273, 11, 46, 14);
contentPane.add(lblName);
lblDepartment = new JLabel("Job");
lblDepartment.setBounds(416, 11, 86, 14);
contentPane.add(lblDepartment);
JLabel l1 = new JLabel("Salary");
l1.setBounds(536, 11, 86, 14);
contentPane.add(l1);
JLabel l2 = new JLabel("Phone");
l2.setBounds(656, 11, 86, 14);
contentPane.add(l2);
JLabel l3 = new JLabel("Aadhar");
l3.setBounds(786, 11, 86, 14);
contentPane.add(l3);
JLabel l4 = new JLabel("Gmail");
l4.setBounds(896, 11, 86, 14);
contentPane.add(l4);
getContentPane().setBackground(Color.WHITE);
}
}