-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInicio.java
More file actions
117 lines (98 loc) · 3.02 KB
/
Copy pathInicio.java
File metadata and controls
117 lines (98 loc) · 3.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
package aplicacion.cliente;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.*;
import javax.sound.sampled.*;
import java.io.*;
import java.util.*;
import aplicacion.utilerias.Archivo;
public class Inicio extends JFrame implements ActionListener{
public JPanel panel;
public JLabel titulo;
public JLabel pregunta;
public JLabel creditos;
public JButton si;
public JButton no;
public JButton irSin;
public Color azul = new Color(7,3,26);
public Clip pepe;
public ArrayList<String> arrayUsers = new ArrayList<>();
public Color color2= new Color(255,203,116);//AMARILLO
public JLabel lbl[]= new JLabel [4];
public Inicio()
{
try {
AudioInputStream pl = AudioSystem.getAudioInputStream(new File("chas.WAV").getAbsoluteFile());
pepe = AudioSystem.getClip();
pepe.open(pl);
} catch(Exception ex) {
System.out.println("Error with playing sound.");
ex.printStackTrace();
}
panel = new JPanel();
panel.setLayout(null);
panel.setBackground(azul);
lbl[0]= new JLabel("");
lbl[0].setBounds(0,0,10,520);
lbl[0].setBackground(color2);
lbl[0].setOpaque(true);
lbl[1]= new JLabel("");
lbl[1].setBounds(475,0,10,520);
lbl[1].setBackground(color2);
lbl[1].setOpaque(true);
lbl[2]= new JLabel("");
lbl[2].setBounds(0,0,500,10);
lbl[2].setBackground(color2);
lbl[2].setOpaque(true);
lbl[3]= new JLabel("");
lbl[3].setBounds(0,465,500,10);
lbl[3].setBackground(color2);
lbl[3].setOpaque(true);
titulo = new JLabel(new ImageIcon(((new ImageIcon("./imagenes/logo1.png")).getImage()).getScaledInstance(384,216,java.awt.Image.SCALE_SMOOTH)));
titulo.setBounds(0,50,500,216);
titulo.setOpaque(false);
pregunta = new JLabel("Viene aqui por primera vez?",JLabel.CENTER);
pregunta.setBounds(100,300,300,23);
pregunta.setFont(new Font("Serif", Font.PLAIN, 22));
pregunta.setForeground(Color.white);
pregunta.setOpaque(false);
si = new JButton("Si");
si.setBounds(125,350,100,30);
si.addActionListener(this);
no = new JButton("No");
no.setBounds(275,350,100,30);
no.addActionListener(this);
arrayUsers = Archivo.leerTodo("./UsuariosContrasennas/Usuarios.txt");
if(arrayUsers == null){
no.setEnabled(false);
}
panel.add(titulo);
panel.add(pregunta);
panel.add(si);
panel.add(no);
panel.add(lbl[0]);panel.add(lbl[1]);panel.add(lbl[2]);panel.add(lbl[3]);
this.add(panel);
this.pack();
this.setTitle("BIENVENIDO");
this.setBounds(150,150,500,520);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setVisible(true);
this.setLayout(null);
}
public void actionPerformed(ActionEvent event)
{
if(event.getSource() == this.si)
{
pepe.start();
Registro r = new Registro();
this.dispose();
}
else if(event.getSource() == this.no)
{
pepe.start();
InicioSesion is = new InicioSesion();
this.dispose();
}
}
}