-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFenetre.java
89 lines (72 loc) · 2.73 KB
/
Fenetre.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
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
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
public class Fenetre extends JFrame {
private JLabel emailLabel;
private JLabel passwordLabel;
private JTextField emailField;
private JPasswordField passwordField;
private JButton createButton;
private JButton redirectButton;
public Fenetre() {
setTitle("Creer un compte");
setSize(400, 300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
emailLabel = new JLabel("Email:");
constraints.gridx = 0;
constraints.gridy = 0;
constraints.insets = new Insets(10, 10, 10, 10);
panel.add(emailLabel, constraints);
emailField = new JTextField(20);
constraints.gridx = 1;
constraints.gridy = 0;
panel.add(emailField, constraints);
passwordLabel = new JLabel("Password:");
constraints.gridx = 0;
constraints.gridy = 1;
panel.add(passwordLabel, constraints);
passwordField = new JPasswordField(20);
constraints.gridx = 1;
constraints.gridy = 1;
panel.add(passwordField, constraints);
createButton = new JButton("Creer un compte");
createButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// System.out.println("Bouton cliqué");
panel.setVisible(false);
JFrame frame2 = new JFrame("Page d'accueil");
frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame2.setSize(500, 500);
frame2.setVisible(true);
}
});
constraints.gridx = 0;
constraints.gridy = 2;
constraints.gridwidth = 2;
constraints.anchor = GridBagConstraints.CENTER;
createButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String email = emailField.getText();
char[] password = passwordField.getPassword();
// envoyer l'email et le mot de passe au serveur pour la creation du compte
}
});
panel.add(createButton, constraints);
add(panel);
setVisible(true);
JButton button1 = new JButton("user");
button1.setBounds(100, 100, 150, 50);
add(button1);
JButton button2 = new JButton("admin");
button2.setBounds(300, 100, 150, 50);
add(button2);
}
}