Ayuda formulario contacto java swing
Publicado por daxtrox (10 intervenciones) el 22/03/2020 22:58:53
Estimados, necesito crear un formulario de contacto a codigo, con la libreria swing: lo que me confunde es el orden de los botones label etc, adjunto lo que llevo hasta ahora.
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
import javax.swing.*;
public class formulario extends JFrame {
private JLabel etiqueta1;
private JLabel etiqueta2;
private JLabel etiqueta3;
private JLabel etiqueta4;
private JTextField texto1;
private JTextField texto2;
private JTextField texto3;
private JTextField texto4;
private JButton boton;
public formulario(){
setLayout(null);
etiqueta1 = new JLabel("Nombre");
etiqueta1.setBounds(30,10,200,300); //horizontal, vertical, largo,ancho
etiqueta2 = new JLabel("Rut");
etiqueta2.setBounds(30,20,200,300);
etiqueta3 = new JLabel("telefono");
etiqueta3.setBounds(30,30,200,300);
etiqueta4 = new JLabel("direccion");
etiqueta4.setBounds(30,40,200,300);
texto1 = new JTextField("1");
texto1.setBounds(20, 10, 100, 20);
texto2 = new JTextField("2");
texto2.setBounds(20, 30, 100, 20);
texto3 = new JTextField("3");
texto3.setBounds(20, 50, 100, 20);
texto4 = new JTextField("4");
texto4.setBounds(20, 70, 100, 20);
boton = new JButton("enviar");
boton.setBounds(100, 200, 90, 30);
add(etiqueta1);
add(etiqueta2);
add(etiqueta3);
add(etiqueta4);
add(texto1);
add(texto2);
add(texto3);
add(texto4);
add(boton);
}
}
Valora esta pregunta


0