-
Notifications
You must be signed in to change notification settings - Fork 1
/
hastagiris.java
158 lines (139 loc) · 5.51 KB
/
hastagiris.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
/**
* Created by msı on 13.5.2016.
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.ArrayList;
public class hastagiris extends JFrame{
JLabel lbl1=new JLabel("T.C. Kimlik Numarası:");
JLabel lbl2=new JLabel("Parola:");
JTextField txt1=new JTextField();
JTextField txt2=new JTextField();
ImageIcon kayıtico=new ImageIcon("C:\\Users\\msı\\IdeaProjects\\HospitalManagement\\src\\icons\\admin_diskette_64px_1110466_easyicon.net.png");
ImageIcon girisico=new ImageIcon("C:\\Users\\msı\\IdeaProjects\\HospitalManagement\\src\\icons\\admin_lock_open_64px_1110475_easyicon.net.png");
ImageIcon passerror=new ImageIcon("C:\\Users\\msı\\IdeaProjects\\HospitalManagement\\src\\icons\\admin_close_64px_1110464_easyicon.net.png");
ImageIcon error=new ImageIcon("C:\\Users\\msı\\IdeaProjects\\HospitalManagement\\src\\icons\\admin_cross_64px_1110465_easyicon.net.png");
JButton btn1=new JButton(girisico);
JButton btn2=new JButton(kayıtico);
DB db=new DB();
public String TC;
public String password;
public String getTC(){
return this.TC;
}
public void setTC(String tc){
this.TC=tc;
}
public String getPassword(){
return this.password;
}
public void setPassword(String pass){
this.password=pass;
}
public hastagiris(){
txt1.setDocument(new JTextFieldCharLimit(11));
txt2.setDocument(new JTextFieldCharLimit(20));
txt1.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
char c=e.getKeyChar();
if(!(Character.isDigit(c) || (c==KeyEvent.VK_BACK_SPACE)|| (c==KeyEvent.VK_DELETE))){
getToolkit().beep();//ses çıkaracak.
e.consume();//yazılmayacak demektir.
}
}
@Override
public void keyPressed(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
}
});
JPanel pnl1=new JPanel(new GridLayout(1,2));
pnl1.add(lbl1);
pnl1.add(txt1);
JPanel pnl2=new JPanel(new GridLayout(1,2));
pnl2.add(lbl2);
pnl2.add(txt2);
JPanel pnl3=new JPanel(new GridLayout(1,2));
pnl3.add(btn1);
pnl3.add(btn2);
add(pnl1);
add(pnl2);
add(pnl3);
btn1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ArrayList<hastagiris> al=db.hastagirisdb();
int sayac=0;
if(!(txt1.getText().equals(""))&&!(txt2.getText().equals(""))){
for (hastagiris a:
al) {
if((a.getTC().equals(txt1.getText()))&&(a.getPassword().equals(txt2.getText()))){
kapat(a.getTC());
}
else{
sayac++;
}
}
if(sayac==al.size()){
JOptionPane.showMessageDialog(null,"Yanlış T.C.Kimlik No/Şifre girdiniz.Yeniden deneyiniz.","Hatalı Giriş",JOptionPane.ERROR_MESSAGE,passerror);
}
}
else{
JOptionPane.showMessageDialog(null,"T.C.Kimlik Numarası veya şifre boş geçilemez!","HATA!",JOptionPane.ERROR_MESSAGE,error);
}
}
});
btn2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
kapat2();
}
});
}
public static void main(String[] args){
hastagiris hstg=new hastagiris();
hstg.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
hstg.setVisible(true);
hstg.setResizable(false);
hstg.setLayout(new GridLayout(3,1));
hstg.setLocationRelativeTo(null);
hstg.setSize(300,200);
hstg.setTitle("Hasta Giriş");
ImageIcon icon1=new ImageIcon("C:\\Users\\msı\\IdeaProjects\\HospitalManagement\\src\\icons\\admin_key_64px_1110472_easyicon.net.png");
hstg.setIconImage(icon1.getImage());
}
public void kapat(String s){
this.dispose();
hastasistem hst=new hastasistem();
hst.gerekliler();
hst.setRandevutckimlikno(s);
hst.txt1.setText(s);
hst.txt1.setEditable(false);
hst.txt16.setText(s);
hst.txt16.setEditable(false);
hst.txt19.setText(s);
hst.txt19.setEditable(false);
}
public void kapat2(){
this.dispose();
hastakayıtol ol=new hastakayıtol();
ol.gerekenler();
}
public void gerekenler(){
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
this.setResizable(false);
this.setLayout(new GridLayout(3,1));
this.setLocationRelativeTo(null);
this.setSize(300,200);
this.setTitle("Hasta Giriş");
ImageIcon icon1=new ImageIcon("C:\\Users\\msı\\IdeaProjects\\HospitalManagement\\src\\icons\\admin_key_64px_1110472_easyicon.net.png");
this.setIconImage(icon1.getImage());
}
}