-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSignUp.java
More file actions
144 lines (114 loc) · 3.34 KB
/
Copy pathSignUp.java
File metadata and controls
144 lines (114 loc) · 3.34 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
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.sql.SQLException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.SQLException;
import java.util.Arrays;
import javax.swing.*;
public class SignUp extends JFrame{
SignUp(){
setTitle("Sign Up");
setSize(500,700);
JLabel idL = new JLabel("ID");
idL.setBounds(100, 120, 80, 30);
JTextField idF = new JTextField();
idF.setBounds(200, 120, 200, 30);
JLabel emailL = new JLabel("e-mail");
emailL.setBounds(100, 170, 80, 30);
JTextField emailF = new JTextField();
emailF.setBounds(200, 170, 200, 30);
JLabel pwL = new JLabel("Password");
pwL.setBounds(100, 220, 80, 30);
JTextField pwF = new JTextField();
pwF.setBounds(200, 220, 200, 30);
JLabel pnL = new JLabel("Phone Number");
pnL.setBounds(100, 270, 80, 30);
JTextField pnF = new JTextField();
pnF.setBounds(200, 270, 200, 30);
JLabel gL = new JLabel("Gender");
gL.setBounds(100, 320, 80, 30);
JTextField gF = new JTextField();
gF.setBounds(200, 320, 200, 30);
JLabel nL = new JLabel("Name");
nL.setBounds(100, 370, 80, 30);
JTextField nF = new JTextField();
nF.setBounds(200, 370, 200, 30);
JLabel birthL = new JLabel("Birth");
birthL.setBounds(100, 420, 80, 30);
JTextField birthF = new JTextField();
birthF.setBounds(200, 420, 200, 30);
JButton button = new JButton("Sign Up ");
button.setBounds(180, 520, 150, 30);
add(idL);
add(idF);
add(emailL);
add(emailF);
add(pwL);
add(pwF);
add(pnL);
add(pnF);
add(nL);
add(nF);
add(gL);
add(gF);
add(birthL);
add(birthF);
add(button);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(null);
setVisible(true);
button.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
String ID=idF.getText();
String Name= nF.getText();
String PWD=pwF.getText();
String Email=emailF.getText();
String Phone=pnF.getText();
String Gender=gF.getText();
String Birth=birthF.getText();
try {
DatagramSocket ds = new DatagramSocket();//데이터 그램 소켓 생성
InetAddress ia = InetAddress.getByName("localhost");
byte[] bf = ID.getBytes();
DatagramPacket dp = new DatagramPacket(bf, bf.length, ia, 9992);
ds.send(dp);
Arrays.fill(bf,(byte)0);
bf = PWD.getBytes();
dp = new DatagramPacket(bf, bf.length, ia, 9992);
ds.send(dp);
Arrays.fill(bf,(byte)0);
bf = Name.getBytes();
dp = new DatagramPacket(bf, bf.length, ia, 9992);
ds.send(dp);
Arrays.fill(bf,(byte)0);
bf = Email.getBytes();
dp = new DatagramPacket(bf, bf.length, ia, 9992);
ds.send(dp);
Arrays.fill(bf,(byte)0);
bf = Phone.getBytes();
dp = new DatagramPacket(bf, bf.length, ia, 9992);
ds.send(dp);
Arrays.fill(bf,(byte)0);
bf = Gender.getBytes();
dp = new DatagramPacket(bf, bf.length, ia, 9992);
ds.send(dp);
Arrays.fill(bf,(byte)0);
bf = Birth.getBytes();
dp = new DatagramPacket(bf, bf.length, ia, 9992);
ds.send(dp);
}catch(IOException es) {}
new login();
setVisible(false);
}
});
}
}