-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPatient_Menu_Panel.java
More file actions
executable file
·185 lines (134 loc) · 5.47 KB
/
Patient_Menu_Panel.java
File metadata and controls
executable file
·185 lines (134 loc) · 5.47 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
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
179
180
181
182
183
184
185
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/*****************************************************************************************************
* A Patient menu to display to the user 3 options, modify, lookup, record lookup. Each button takes you
* to a different panel, the modify panel is an inner class in this file, the other 2 are seperate files
* named Patient_Lookup_Panel and Patient_Record_Lookup_Panel.
*****************************************************************************************************/
public class Patient_Menu_Panel extends JPanel
{
/* Pointer to the main java window to access its get() methods for other panels */
protected Hospital_Frame main_frame;
/* Button to return the screen to the main menu */
protected JPanel main_menu_button;
/* Current interface displayed to the user, displaying either button options or an interface based
* on button pressed */
protected JPanel current_panel;
/*********************************************************************************
* Main constructor used for setting up the Patient_Menu_Panel.
*********************************************************************************/
public Patient_Menu_Panel(Hospital_Frame main)
{
this.main_frame = main;
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
add(current_panel = new Patient_Button_Options());
add(main_menu_button = new Main_Menu_Button(main_frame));
// skip a row in the grid layout
//add(new JLabel(""));
}
/*********************************************************************************
* Switches the current main panel to the passed in one.
*********************************************************************************/
protected void changeCurrentPanel(JPanel panel)
{
removeAll();
add(current_panel = panel);
// re-add the main menu button so it appears after the panel again
add(main_menu_button = new Main_Menu_Button(main_frame));
revalidate();
repaint();
} // end changeCurrentPanel()
/*********************************************************************************
* Different button options for the user for interacting with the patient tuples
* in the database.
*********************************************************************************/
protected class Patient_Button_Options extends JPanel
{
/*********************************************************************************
* Main constructor for the Patient_Button_Options class.
*********************************************************************************/
public Patient_Button_Options()
{
setLayout(new GridBagLayout());
add(new Modify_Patient_Info_Button());
add(new Search_Patients_Button());
add(new Search_Records_Patients_Button());
}
/*********************************************************************************
* Button to take user to modify patient info panel by switching the current panel
* to an instance of Modify_Patient_Info_Panel (to be created).
*********************************************************************************/
private class Modify_Patient_Info_Button extends JButton
{
public Modify_Patient_Info_Button()
{
super("Modify Patient Record Info");
addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
changeCurrentPanel(new Modify_Record_Menu_Panel());
}
});
}
}
/*********************************************************************************
* Button to take user to search patients panel by switching the current panel
* to an instance of Search_Patients_Panel.
*********************************************************************************/
private class Search_Patients_Button extends JButton
{
public Search_Patients_Button()
{
super("Search Patients");
addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
changeCurrentPanel(new Patient_Lookup_Panel());
}
});
}
}
/*********************************************************************************
* Button to take user to search patients panel by switching the current panel
* to an instance of Search_Records_Patients_Panel.
*********************************************************************************/
private class Search_Records_Patients_Button extends JButton
{
public Search_Records_Patients_Button()
{
super("Search Records for a Patient");
addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
changeCurrentPanel(new Patient_Record_Lookup_Panel());
}
});
}
}
} // end Patient_Button_Options class
/*********************************************************************************
* Returns the user to the Patient menu.
*********************************************************************************/
private class Back_Button extends JButton
{
/******************************************************************
* Main constructor for Back_Button
******************************************************************/
public Back_Button()
{
super("<- Back");
addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
changeCurrentPanel(new Patient_Button_Options());
//main_frame.changeScreen(new Patient_Menu_Panel(main_frame));
}
});
}
} // end Back_Button class
} // end patient menu class