-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModify_Record_Menu_Panel.java
More file actions
99 lines (71 loc) · 2.7 KB
/
Modify_Record_Menu_Panel.java
File metadata and controls
99 lines (71 loc) · 2.7 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 javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/*****************************************************************************************************
* A menu displayed to the user to insert a new patient into the database.
*****************************************************************************************************/
public class Modify_Record_Menu_Panel extends JPanel
{
/* Text fields for the user to enter intput data */
private JTextField record_id_field;
// fields that might need to be drop down - dob, gender, location
/* String to get input data from fields */
private String input;
/*********************************************************************************
* Main constructor used for setting up the Insert_Patient_Menu_Panel.
*********************************************************************************/
public Modify_Record_Menu_Panel()
{
setLayout(new GridLayout(2, 2));
//setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
add(new Centered_Text_Panel("Enter ID of the record to be inactivated: "));
add(record_id_field = new JTextField(5));
add(new JLabel(""));
add(new Submit_Button());
}
/******************************************************************************
* Submit button for Insert_Patient_Menu_Panel class.
******************************************************************************/
private class Submit_Button extends JButton
{
/******************************************************************
* Main constructor for Submit_Button
******************************************************************/
public Submit_Button()
{
super("Submit");
addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
// get input from ssn field into ssn string variable
loadText();
// insert the patient into the database
Patient.changeRecordStatus(input);
JOptionPane.showMessageDialog(null, "Submitted");
}
});
}
/******************************************************************
* Load input from ssn field into corresponding string variable.
*
* If load is successful, true is returned, otherwise false
* is returned.
******************************************************************/
private boolean loadText()
{
// get ssn from field
try
{
input = record_id_field.getText() + "\t";
}
catch (Exception e)
{
JOptionPane.showMessageDialog(new JPanel(), "ID input could not be read", "Error", JOptionPane.ERROR_MESSAGE);
return false;
}
// if this point is reached age and ssn were successfully retrieved
return true;
}
} // end Submit_Button class
} // end patient menu class