-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStaffSearchPage.java
More file actions
99 lines (89 loc) · 2.87 KB
/
StaffSearchPage.java
File metadata and controls
99 lines (89 loc) · 2.87 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
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
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.ImageIcon;
@SuppressWarnings("serial")
public class StaffSearchPage extends JFrame
{
private JPanel contentPane;
private JPanel tablePanel;
private JTextField fNameField, staffIdField;
JFrame frame=new JFrame("Staff Records");
public void run()
{
frame.setVisible(true);
frame.setResizable(false);
frame.setBounds(50, 50, 1800, 900);
contentPane = new JPanel();
frame.setContentPane(contentPane);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(null);
tablePanel=Search.searchTableView(null, 0, false);
tablePanel.setBounds(95, 120, 1600, 700);
contentPane.add(tablePanel);
JLabel lblSearchByFirst = new JLabel("Search by First Name");
lblSearchByFirst.setFont(new Font("Berlin Sans FB", Font.PLAIN, 24));
lblSearchByFirst.setBounds(95, 76, 223, 23);
contentPane.add(lblSearchByFirst);
fNameField = new JTextField();
fNameField.setFont(new Font("Calibri", Font.PLAIN, 24));
fNameField.setBounds(330, 71, 401, 32);
contentPane.add(fNameField);
fNameField.setColumns(10);
fNameField.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
String fName=fNameField.getText();
tablePanel=Search.searchTableView(fName, 0, false);
contentPane.add(tablePanel);
}
});
JLabel lblSearchByPatient = new JLabel("Search By Staff ID");
lblSearchByPatient.setFont(new Font("Berlin Sans FB", Font.PLAIN, 24));
lblSearchByPatient.setBounds(852, 71, 232, 27);
contentPane.add(lblSearchByPatient);
staffIdField = new JTextField();
staffIdField.setFont(new Font("Calibri", Font.PLAIN, 24));
staffIdField.setBounds(1067, 72, 349, 32);
contentPane.add(staffIdField);
staffIdField.setColumns(10);
staffIdField.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
if(staffIdField.getText().isEmpty())
{
tablePanel=Search.searchTableView(null, 0, false);
contentPane.add(tablePanel);
}
else
{
int pID=-1;
try
{
pID=Integer.parseInt(staffIdField.getText());
tablePanel=Search.searchTableView(null, pID, false);
contentPane.add(tablePanel);
}
catch(Exception w)
{
JOptionPane.showMessageDialog(null, "Invalid Staff ID");
}
}
}
});
JLabel lblImage = new JLabel("");
lblImage.setIcon(new ImageIcon("C:/Users/Its'Me/Desktop/Image/search.jpg"));
lblImage.setBounds(0, 0, 1800, 900);
contentPane.add(lblImage);
}
}