-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewDoctorProfile.java
199 lines (174 loc) · 8.68 KB
/
ViewDoctorProfile.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
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package hospitalmanagementsystem;
import java.util.ArrayList;
import javax.swing.JOptionPane;
/**
*
* @author Fame
*/
public class ViewDoctorProfile extends javax.swing.JFrame {
FileHandler f=new FileHandler();
/**
* Creates new form ViewDoctorProfile
*/
public ViewDoctorProfile() {
super("****DOCTOR PROFILE****");
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
doctorIdJLabel = new javax.swing.JLabel();
doctorIdJField = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
backJB = new javax.swing.JButton();
submitJB = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setFont(new java.awt.Font("Stencil", 1, 24)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 0, 0));
jLabel1.setText("VIEW DOCTOR PROFILE");
getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(102, 11, -1, -1));
doctorIdJLabel.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
doctorIdJLabel.setForeground(new java.awt.Color(255, 102, 51));
doctorIdJLabel.setText("DOCTOR ID:");
getContentPane().add(doctorIdJLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(39, 96, -1, -1));
doctorIdJField.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
doctorIdJFieldMouseClicked(evt);
}
});
getContentPane().add(doctorIdJField, new org.netbeans.lib.awtextra.AbsoluteConstraints(176, 90, 196, 32));
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jScrollPane1.setViewportView(jTextArea1);
getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 150, 234, 118));
backJB.setBackground(new java.awt.Color(153, 153, 255));
backJB.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
backJB.setIcon(new javax.swing.ImageIcon("C:\\Users\\Fame\\Documents\\NetBeansProjects\\HospitalManagementSystem\\src\\hospitalmanagementsystem\\Images\\Go-back-icon.png")); // NOI18N
backJB.setText("BACK");
backJB.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
backJBActionPerformed(evt);
}
});
getContentPane().add(backJB, new org.netbeans.lib.awtextra.AbsoluteConstraints(47, 297, -1, -1));
submitJB.setBackground(new java.awt.Color(102, 102, 255));
submitJB.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
submitJB.setIcon(new javax.swing.ImageIcon("C:\\Users\\Fame\\Documents\\NetBeansProjects\\HospitalManagementSystem\\src\\hospitalmanagementsystem\\Images\\Done-icon.png")); // NOI18N
submitJB.setText("SUBMIT");
submitJB.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
submitJBActionPerformed(evt);
}
});
getContentPane().add(submitJB, new org.netbeans.lib.awtextra.AbsoluteConstraints(324, 300, 120, 26));
jLabel2.setIcon(new javax.swing.ImageIcon("C:\\Users\\Fame\\Documents\\NetBeansProjects\\HospitalManagementSystem\\src\\hospitalmanagementsystem\\Images\\Stethoscope.jpg")); // NOI18N
getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 510, 340));
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void doctorIdJFieldMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_doctorIdJFieldMouseClicked
// TODO add your handling code here:
doctorIdJField.setText("");
jTextArea1.setText("");
jTextArea1.setEditable(false);
}//GEN-LAST:event_doctorIdJFieldMouseClicked
private void backJBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backJBActionPerformed
// TODO add your handling code here:
PatientFunctionFrame pff=new PatientFunctionFrame();
pff.setVisible(true);
this.dispose();
}//GEN-LAST:event_backJBActionPerformed
private void submitJBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitJBActionPerformed
// TODO add your handling code here:
boolean check=false;
ArrayList<Doctor> s=f.read();
try{
String id=doctorIdJField.getText();
if(id.equals("")){
throw new NullPointerException();
}
else{
try{
int idd=Integer.parseInt(id);
s=f.getArray();
for(int i=0;i<s.size();i++){
Doctor p=s.get(i);
if(p.getId()==(idd)){
check=true;
jTextArea1.append(s.get(i).toString());
}
}
if(check==true){
JOptionPane.showMessageDialog(this, "****RECORD IS FOUND SUCCESSFULLY****","***CONFIRMATION***",JOptionPane.INFORMATION_MESSAGE);
}
else if(check==false){
JOptionPane.showMessageDialog(this, "****RECORD IS NOT FOUND!!!!","***INVALID***",JOptionPane.ERROR_MESSAGE);
}
}
catch(NumberFormatException e){
JOptionPane.showMessageDialog(this, "****NUMBER FORMAT EXCEPTION, ****ENTER ANY INTEGER****","**INVALID**",JOptionPane.ERROR_MESSAGE);
}
}
}
catch(NullPointerException e){
JOptionPane.showMessageDialog(this, "****NULL POINTER EXCEPTION,FILL DOCTOR ID FIELD****","**INVALID**",JOptionPane.ERROR_MESSAGE);
}
}//GEN-LAST:event_submitJBActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ViewDoctorProfile.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ViewDoctorProfile.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ViewDoctorProfile.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ViewDoctorProfile.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ViewDoctorProfile().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton backJB;
private javax.swing.JTextField doctorIdJField;
private javax.swing.JLabel doctorIdJLabel;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JButton submitJB;
// End of variables declaration//GEN-END:variables
}