-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDoctor_Menu_Panel.java
More file actions
executable file
·178 lines (120 loc) · 5 KB
/
Doctor_Menu_Panel.java
File metadata and controls
executable file
·178 lines (120 loc) · 5 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
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/*****************************************************************************************************
* A Doctor menu to display to the user 2 panels, 1 for looking up a Doctor on the left side of the
* window, and a 2nd on the right side which is selected from 3 options from buttons for updating
* Doctor info, Doctor record lookup, and modify treatment plan.
*****************************************************************************************************/
public class Doctor_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 Doctor_Menu_Panel.
*********************************************************************************/
public Doctor_Menu_Panel(Hospital_Frame main)
{
this.main_frame = main;
//setLayout(new GridLayout(2, 1));
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
add(current_panel = new Doctor_Button_Options());
// skip a row in the grid layout
//add(new JLabel(""));
add(main_menu_button = new Main_Menu_Button(main_frame));
}
/*********************************************************************************
* Switches the current main panel to the passed in one.
*********************************************************************************/
protected void changeCurrentPanel(JPanel panel)
{
// get rid of all components currently on the main_screen
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 Doctor tuples
* in the database.
*********************************************************************************/
protected class Doctor_Button_Options extends JPanel
{
/*********************************************************************************
* Main constructor for the Doctor_Button_Options class.
*********************************************************************************/
public Doctor_Button_Options()
{
setLayout(new GridBagLayout());
add(new Search_Doctors_Button());
add(new Search_Records_Doctors_Button());
}
/*********************************************************************************
* Button to take user to search Doctors panel by switching the current panel
* to an instance of Search_Doctors_Panel.
*********************************************************************************/
private class Search_Doctors_Button extends JButton
{
public Search_Doctors_Button()
{
super("Search Doctors");
addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
changeCurrentPanel(new Doctor_Lookup_Panel());
}
});
}
}
/*********************************************************************************
* Button to take user to search Doctors panel by switching the current panel
* to an instance of Search_Records_Doctors_Panel.
*********************************************************************************/
private class Search_Records_Doctors_Button extends JButton
{
/******************************************************************
* Main constructor for Search_Records_Doctors_Button.
******************************************************************/
public Search_Records_Doctors_Button()
{
super("Search Records for a Doctor");
addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
changeCurrentPanel(new Doctor_Record_Lookup_Panel());
}
});
}
}
} // end Doctor_Button_Options class
/*********************************************************************************
* Returns the user to the Doctor 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 Doctor_Button_Options());
//main_frame.changeScreen(new Doctor_Menu_Panel(main_frame));
}
});
}
} // end Back_Button class
} // end Doctor menu class