More Related Content
More from Robert Wolf (20)
Codigo fuente de computrachos con fines educativos
- 1. 1.
Codigo Fuente de Computrachos con Fines Educativos!!!!!!!!!!!!!!!
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
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JPasswordField;
import javax.swing.JOptionPane;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Login extends JFrame
{
private JLabel label, label2;
private JTextField user;
private JPasswordField pass;
private JButton boton1;
public Login()
{
super("LOGIN (user: admin pass: 123");
getContentPane().setLayout(null);
//CREAR ETIQUETA Y CAMBIAR ATRIBUTOS
label=new JLabel("ID DE USUARIO");
label.setForeground(Color.red);
label.setFont(new Font("Arial",Font.BOLD,16));
label.setBounds(20,10,150,30);
getContentPane().add(label);
//CREAR CAMPO DE TEXTO Y COLOCAR EN POSICION
user=new JTextField(15);
user.setBounds(150,10,150,30);
getContentPane().add(user);
//CREAR ETIQUETA Y CAMBIAR ATRIBUTOS
label2=new JLabel("PASSWORD");
label2.setForeground(Color.red);
label2.setFont(new Font("Arial",Font.BOLD,16));
label2.setBounds(20,60,150,30);
getContentPane().add(label2);
//CREAR CAMPO DE TEXTO Y COLOCAR EN POSICION
pass=new JPasswordField(15);
pass.setBounds(150,60,150,30);
getContentPane().add(pass);
//CREAR BOTON Y CAMBIAR ATRIBUTOS
boton1 = new JButton ("INGRESAR");
boton1.setForeground(Color.BLUE);
boton1.setFont(new Font("Arial",Font.BOLD,18));
boton1.setBounds(150,90,150,30);
//AQUI SE AGREGA EL EVENTO DEL BOTON DIRECTAMENTE
boton1.addActionListener(new ActionListener()