-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregest.java
More file actions
340 lines (281 loc) · 15.1 KB
/
regest.java
File metadata and controls
340 lines (281 loc) · 15.1 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
import java.io.FileWriter;
import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.io.BufferedWriter;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
/*
* 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.
*/
/**
*
* @author mousa
*/
public class regest extends javax.swing.JFrame {
/**
* Creates new form regest
*/
private static ArrayList<String> d=new ArrayList<String>();
public regest() {
initComponents();
setExtendedState(MAXIMIZED_BOTH);
}
public JPasswordField getjPasswordField2() {
return jPasswordField2;
}
public JTextField getjTextField5() {
return jTextField5;
}
public JTextField getjTextField7() {
return jTextField7;
}
/**
* 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();
jLabel9 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jPasswordField2 = new javax.swing.JPasswordField();
jTextField5 = new javax.swing.JTextField();
jTextField6 = new javax.swing.JTextField();
jTextField7 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jComboBox1 = new javax.swing.JComboBox();
jTextField10 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/8a4e1e8d6b340da246f22c5fac5b655e.jpg"))); // NOI18N
jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/8a4e1e8d6b340da246f22c5fac5b655e.jpg"))); // NOI18N
jLabel9.setText("jLabel9");
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/8a4e1e8d6b340da246f22c5fac5b655e.png"))); // NOI18N
jLabel2.setText("jLabel2");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPasswordField2.setBackground(new java.awt.Color(255, 255, 102));
jPasswordField2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jPasswordField2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jPasswordField2ActionPerformed(evt);
}
});
getContentPane().add(jPasswordField2, new org.netbeans.lib.awtextra.AbsoluteConstraints(840, 640, 380, 30));
jTextField5.setBackground(new java.awt.Color(255, 255, 102));
jTextField5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jTextField5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField5ActionPerformed(evt);
}
});
getContentPane().add(jTextField5, new org.netbeans.lib.awtextra.AbsoluteConstraints(840, 470, 380, -1));
jTextField6.setBackground(new java.awt.Color(255, 255, 102));
jTextField6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jTextField6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField6ActionPerformed(evt);
}
});
getContentPane().add(jTextField6, new org.netbeans.lib.awtextra.AbsoluteConstraints(840, 420, 380, -1));
jTextField7.setBackground(new java.awt.Color(255, 255, 102));
jTextField7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jTextField7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField7ActionPerformed(evt);
}
});
getContentPane().add(jTextField7, new org.netbeans.lib.awtextra.AbsoluteConstraints(840, 370, 380, -1));
jButton1.setFont(new java.awt.Font("Times New Roman", 0, 24)); // NOI18N
jButton1.setIcon(new javax.swing.ImageIcon("C:\\Users\\mousa\\Downloads\\icons8-save-50.png")); // NOI18N
jButton1.setText("Save");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(800, 770, 170, 90));
jButton2.setFont(new java.awt.Font("Times New Roman", 0, 24)); // NOI18N
jButton2.setIcon(new javax.swing.ImageIcon("C:\\Users\\mousa\\Downloads\\icons8-close-64.png")); // NOI18N
jButton2.setText("cancel");
jButton2.setPreferredSize(new java.awt.Dimension(133, 59));
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(1080, 770, 170, 90));
jComboBox1.setBackground(new java.awt.Color(255, 255, 102));
jComboBox1.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Male ", "Female", " " }));
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox1ActionPerformed(evt);
}
});
getContentPane().add(jComboBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(840, 580, 380, 30));
jTextField10.setBackground(new java.awt.Color(255, 255, 102));
jTextField10.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jTextField10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField10ActionPerformed(evt);
}
});
getContentPane().add(jTextField10, new org.netbeans.lib.awtextra.AbsoluteConstraints(840, 520, 380, -1));
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel3.setForeground(new java.awt.Color(240, 240, 240));
jLabel3.setText("Name:");
jLabel3.setPreferredSize(new java.awt.Dimension(117, 34));
getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(580, 360, -1, -1));
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel4.setForeground(new java.awt.Color(240, 240, 240));
jLabel4.setText("Student ID:");
jLabel4.setPreferredSize(new java.awt.Dimension(117, 34));
getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(570, 420, 140, -1));
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel5.setForeground(new java.awt.Color(240, 240, 240));
jLabel5.setText(" phone number:");
jLabel5.setPreferredSize(new java.awt.Dimension(117, 34));
getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 470, 190, -1));
jLabel6.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel6.setForeground(new java.awt.Color(240, 240, 240));
jLabel6.setText("Email:");
jLabel6.setPreferredSize(new java.awt.Dimension(117, 34));
getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(580, 520, -1, -1));
jLabel7.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel7.setForeground(new java.awt.Color(240, 240, 240));
jLabel7.setText("Gender:");
jLabel7.setPreferredSize(new java.awt.Dimension(117, 34));
getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(580, 580, -1, -1));
jLabel8.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel8.setForeground(new java.awt.Color(240, 240, 240));
jLabel8.setText("password:");
jLabel8.setPreferredSize(new java.awt.Dimension(117, 34));
getContentPane().add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(570, 640, 150, -1));
getContentPane().add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(1190, 180, -1, -1));
jLabel11.setForeground(new java.awt.Color(240, 240, 240));
jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/wallpaperflare.com_wallpaper (4).png"))); // NOI18N
jLabel11.setText("jLabel11");
getContentPane().add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pack();
}// </editor-fold>//GEN-END:initComponents
private void jPasswordField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPasswordField2ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jPasswordField2ActionPerformed
private void jTextField5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField5ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField5ActionPerformed
private void jTextField6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField6ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField6ActionPerformed
private void jTextField7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField7ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField7ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
setVisible(false);
new login().setVisible(true);
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try{
//take the file which we will write in
BufferedWriter f=new BufferedWriter(new FileWriter("C:\\Users\\LENOVO\\Desktop\\Data.txt",true));
//cheak if all data is inserted
if(!(jTextField7.getText().equals("")||jTextField5.getText().equals("")||jPasswordField2.getText().equals("")||jTextField6.getText().equals(""))){
f.write(jTextField7.getText());
f.newLine();
f.write(jTextField5.getText());
f.newLine();
f.write(jPasswordField2.getText());
f.newLine();
f.write(jTextField6.getText());
f.newLine();
f.close();
//when all the data is inserted get back to login page
setVisible(false);
new login().setVisible(true);
}else{
JOptionPane.showMessageDialog(null,"Missing data");
}
}catch(Exception e){
JOptionPane.showMessageDialog(null,e);
}
}//GEN-LAST:event_jButton1ActionPerformed
private void jTextField10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField10ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField10ActionPerformed
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jComboBox1ActionPerformed
/**
* @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(regest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(regest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(regest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(regest.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 regest().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JComboBox jComboBox1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPasswordField jPasswordField2;
private javax.swing.JTextField jTextField10;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private javax.swing.JTextField jTextField7;
// End of variables declaration//GEN-END:variables
}