-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathV01.java
More file actions
314 lines (247 loc) · 9.02 KB
/
Copy pathV01.java
File metadata and controls
314 lines (247 loc) · 9.02 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
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import javax.swing.border.*;
public class V01 {
public V01() {
JFrame Registro = new JFrame ();
Registro.setBounds(200, 100, 1000, 600);
Registro.setTitle("Registro");
Registro.setLayout(null);
//PANEL
JPanel panel = new JPanel ();
panel.setBounds(0, 0, 1000, 600);
panel.setBackground(Color.decode("#E1BEE7"));
panel.setLayout(null);
//LOGO
JLabel logo = new JLabel();
ImageIcon log = new ImageIcon("src/sol.png");
logo.setBounds(450, 20, 100, 100 );
Icon imagen2;
imagen2 = new ImageIcon(log.getImage().getScaledInstance(logo.getWidth(),
logo.getHeight(), Image.SCALE_AREA_AVERAGING));
logo.setIcon(imagen2);
//TEXTO BIENVENIDA
JLabel Bienvenida = new JLabel ();
String B = "Bienvenido a HOPELANDS ";
Bienvenida.setBounds(300, 80, 650, 140);
Bienvenida.setText(B);
Bienvenida.setFont(new Font ("Comic Sans MS", 30, 35));
JLabel mensaje = new JLabel();
String m = "¿Ya tienes una cuenta? Inicia sesión";
mensaje.setBounds(350, 120, 650, 140);
mensaje.setText(m);
mensaje.setFont(new Font("Comic Sans MS", 15, 20));
//NOMBRE
JLabel textoA = new JLabel ();
String tA = "Nombre(s):";
textoA.setText(tA);
textoA.setBackground(Color.WHITE);
textoA.setFont(new Font ("Comic Sans MS", 10, 15 ));
textoA.setBounds(200, 215, 83, 55);
JTextField CajaTN = new JTextField ();
CajaTN.setBounds(280, 230, 150, 30);
CajaTN.setForeground(Color.BLACK);
CajaTN.setBorder(new LineBorder (Color.BLACK));
//APELLIDOS
JLabel textoB = new JLabel ();
String tB = "Apellido:";
textoB.setText(tB);
textoB.setBackground(Color.WHITE);
textoB.setFont(new Font("Comic Sans MS", 10, 15));
textoB.setBounds(450, 215, 122, 55);
//BARRA APELLIDOS
JTextField CajaTA = new JTextField ();
CajaTA.setBounds(515, 230, 150, 30 );
CajaTA.setForeground(Color.BLACK);
CajaTA.setBorder(new LineBorder(Color.BLACK));
//EDAD
JLabel Edad = new JLabel ();
String E = "Edad:";
Edad.setText(E);
Edad.setBackground(Color.BLACK);
Edad.setFont(new Font("Comic Sans MS", 10, 15));
Edad.setBounds(690, 215, 130,55);
JTextField CajaE = new JTextField ();
CajaE.setBounds(730, 230, 30, 30);
CajaE.setForeground(Color.BLACK);
CajaE.setBorder(new LineBorder (Color.BLACK));
//SEXO
JLabel Sexo = new JLabel ();
String S = "Sexo:";
Sexo.setText(S);
Sexo.setBackground(Color.BLACK);
Sexo.setFont(new Font ("Comic Sans MS", 10, 15));
Sexo.setBounds(140, 260, 122, 55);
JComboBox<String> combo = new JComboBox<String>();
combo.addItem("Femenino");
combo.addItem("Masculino");
combo.addItem("Sin Definir");
combo.setBounds(180, 270, 100, 30);
//ESTADO
JLabel Estado = new JLabel ();
String Es = "Estado:";
Estado.setText(Es);
Estado.setBackground(Color.BLACK);
Estado.setFont(new Font("Comic Sans MS", 10, 15));
Estado.setBounds(300, 260, 122, 55);
JTextField CajaEs = new JTextField ();
CajaEs.setBounds(355, 270, 120, 30);
CajaEs.setForeground(Color.BLACK);
CajaEs.setBorder(new LineBorder (Color.BLACK));
//MUNICIPIO
JLabel Municipio = new JLabel ();
String M = "Municipio:";
Municipio.setText(M);
Municipio.setBackground(Color.BLACK);
Municipio.setFont(new Font ("Comic Sans MS", 10, 15 ));
Municipio.setBounds(490, 260, 140, 55);
JTextField CajaM = new JTextField();
CajaM.setBounds(560, 270, 190, 30);
CajaM.setForeground(Color.BLACK);
CajaM.setBorder(new LineBorder(Color.BLACK));
//CODIGO POSTAL
JLabel Postal = new JLabel();
String CP = "C.P.:";
Postal.setText(CP);
Postal.setBackground(Color.BLACK);
Postal.setFont(new Font ("Comic Sans MS", 10, 15));
Postal.setBounds(760, 260, 122, 55);
JTextField CajaCP= new JTextField();
CajaCP.setBounds(790, 270, 100, 30);
CajaCP.setForeground(Color.BLACK);
CajaCP.setBorder(new LineBorder(Color.BLACK));
//TELEFONO
JLabel Celular = new JLabel ();
String RCelular = "Celular:";
Celular.setText(RCelular);
Celular.setBackground(Color.BLACK);
Celular.setFont(new Font ("Comic Sans MS", 10, 15));
Celular.setBounds(80, 300, 140, 55 );
JTextField CajaCelular = new JTextField ();
CajaCelular.setBounds(140, 310, 120, 30);
CajaCelular.setForeground(Color.BLACK);
CajaCelular.setBorder(new LineBorder (Color.BLACK));
//USUARIO
JLabel Usuario = new JLabel();
String Us = "Usuario:";
Usuario.setText(Us);
Usuario.setFont(new Font ("Comic Sans MS", 10, 15));
Usuario.setBackground(Color.BLACK);
Usuario.setBounds(267, 310, 200, 30);
JTextField CUs = new JTextField();
CUs.setBounds(325, 310, 150, 30);
CUs.setForeground(Color.BLACK);
CUs.setBorder(new LineBorder(Color.BLACK));
//CORREO
JLabel Correo = new JLabel ();
String Cor = "Correo:";
Correo.setText(Cor);
Correo.setBackground(Color.BLACK);
Correo.setFont(new Font("Comic Sans MS",10, 15));
Correo.setBounds(485, 300, 122, 55);
JTextField CajaCor = new JTextField();
CajaCor.setBounds(540, 310, 200, 30);
CajaCor.setForeground(Color.BLACK);
CajaCor.setBorder(new LineBorder(Color.BLACK));
//CONTRASEÑA
JLabel Contrasena = new JLabel();
String Contra = "Contraseña:";
Contrasena.setText(Contra);
Contrasena.setBackground(Color.BLACK);
Contrasena.setFont(new Font("Comic Sans MS",10, 15));
Contrasena.setBounds(745, 300, 140, 55);
JTextField CajaContra = new JTextField();
CajaContra.setBounds(830, 310, 120, 30);
CajaContra.setForeground(Color.BLACK);
CajaContra.setBorder(new LineBorder(Color.BLACK));
//BOTONES
JButton bAnterior = new JButton ();
bAnterior.setText("Regresar");
bAnterior.setBorder(new LineBorder(Color.BLACK));
bAnterior.setBounds(250, 500, 120, 30);
JButton bSiguiente = new JButton ();
bSiguiente.setText("Siguiente");
bSiguiente.setBorder(new LineBorder(Color.BLACK));
bSiguiente.setBounds(680, 500, 120, 30);
//CUENTA CREADA
JDialog registrado = new JDialog();
registrado.setBounds(500, 250, 270, 150);
registrado.setLayout(null);
JPanel fondo = new JPanel();
fondo.setBackground(Color.decode("#e040fb"));
fondo.setBounds(0, 0, 300, 200);
fondo.setLayout(null);
registrado.add(fondo);
JLabel texto = new JLabel();
String text = "cuenta creada existosamente";
texto.setText(text);
texto.setBackground(Color.BLACK);
texto.setFont(new Font("Verdana", 15, 15));
texto.setBounds(20, 10, 300, 70);
fondo.add(texto);
//BOTON PARA REGRESAR
JButton regreso = new JButton();
//BOTON
JButton aceptar = new JButton();
aceptar.setBounds(85, 55, 75, 25);
fondo.add(aceptar);
aceptar.setFont(new Font ("Verdana", 10, 10));
aceptar.setText("Aceptar");
aceptar.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae) {
registrado.setVisible(false);
Inicio k = new Inicio();
}
});
//AGREGADOS A LA VENTANA
Registro.add(panel);
panel.add(logo);
panel.add(textoA);
panel.add(Bienvenida);
panel.add(mensaje);
panel.add(CajaTN);
panel.add(textoB);
panel.add(CajaTA);
panel.add(Edad);
panel.add(CajaE);
panel.add(Sexo);
panel.add(combo);
panel.add(Estado);
panel.add(CajaEs);
panel.add(Municipio);
panel.add(CajaM);
panel.add(Postal);
panel.add(CajaCP);
panel.add(Usuario);
panel.add(CUs);
panel.add(Correo);
panel.add(CajaCor);
panel.add(Contrasena);
panel.add(CajaContra);
panel.add(Celular);
panel.add(CajaCelular);
panel.add(bAnterior);
panel.add(bSiguiente);
Registro.setVisible(true);
//CONEXION
Conexion1 cn = new Conexion1();
cn.conectar();
bSiguiente.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
if(cn.buscarUsuarioRpetido(CUs.getText().toString())==true){
JOptionPane.showMessageDialog(null, "EL USUARIO EXISTE");
}else {
int reg = cn.insertarActualizarEliminar(("INSERT INTO Caridad1 ( Nombre, Apellido, Edad, Estado, Municipio, Cp, Correo, Celular) VALUES ( '"+CajaTN.getText()+"', '"+CajaTA.getText()+"', '"+CajaE.getText()+"', '"+CajaEs.getText()+"', '"+CajaM.getText()+"', '"+CajaCP.getText()+"', '"+CajaCor.getText()+"', '"+CajaCelular.getText()+"' )"));
int reg1 = cn.insertarActualizarEliminar("INSERT INTO cuentas(Usuario, Contraseña) Values ('"+CUs.getText()+"', '"+CajaContra.getText()+"')");
registrado.setVisible(true);
Registro.setVisible(false);
System.out.println("registros insertados: " + reg); //VERIFICA
System.out.println("registros insertados: " + reg1);
}
}
});
//NO ESTABA EL CODIGO PARA INGRESAR JAJAJAJAJ QUE PASÓ :0 NO SE, SI HABIA ESTADO FUNCIONANDO HACE RATO D:
}
}