-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusuario.java
39 lines (33 loc) · 923 Bytes
/
usuario.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
import javax.swing.*;
import java.awt.event.*;
public class Formulario extends JFrame implements ActionListener{
private JTextField textfield1;
private JLabel label1;
private JButton boton1;
public Formulario(){
setLayout(null);
label1 = new JLabel("Usuario:");
label1.setBounds(10,10,100,30);
add(label1);
textfield1 = new JTextField("");
textfield1.setBounds(120,17,150,20);
add(textfield1);
boton1 = new JButton("Aceptar");
boton1.setBounds(10,80,100,30);
add(boton1);
boton1.addActionListener(this);
}
public void actionPerformed(ActionEvent e){
if(e.getSource() == boton1){
String texto = textfield1.getText();
setTitle(texto);
}
}
public static void main(String args[]){
Formulario formulario1 = new Formulario();
formulario1.setBounds(0,0,300,150);
formulario1.setVisible(true);
formulario1.setResizable(false);
formulario1.setLocationRelativeTo(null);
}
}