-
Notifications
You must be signed in to change notification settings - Fork 0
/
FrameAddMdp.java
87 lines (65 loc) · 2.16 KB
/
FrameAddMdp.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.BorderLayout;
import javax.swing.*;
import java.awt.event.*;
public class FrameAddMdp extends JFrame implements ActionListener
{
Controleur ctrl;
PanelAddMdp panelInfo;
private JButton btnValider;
public FrameAddMdp( Controleur ctrl )
{
this.ctrl = ctrl;
this.setTitle ( "Ajout d'un compte" );
this.setLocation(180, 180);
/*----------------------------*/
/* Création des panels */
/*----------------------------*/
this.panelInfo = new PanelAddMdp (ctrl);
this.btnValider = new JButton( "Valider");
/*--------------------------------*/
/* positionnement des panels */
/*--------------------------------*/
this.add( this.panelInfo );
this.add( this.btnValider, BorderLayout.SOUTH );
/*----------------------------------------*/
/* Activation des composants */
/*----------------------------------------*/
this.btnValider.addActionListener( this );
this.pack();
this.setDefaultCloseOperation( FrameAddMdp.EXIT_ON_CLOSE );
this.setVisible( true );
}
public void actionPerformed(ActionEvent e)
{
if ( e.getSource() == this.btnValider)
{
String sRet;
String link;
String note;
if ( this.panelInfo.getLink().equals("") )
{
link = "{absent}";
}
else
{
link = this.panelInfo.getLink();
link = this.ctrl.encode(link);
}
if ( this.panelInfo.getNote().equals("") )
{
note = "{absent}";
}
else
{
note = this.panelInfo.getNote();
note = this.ctrl.encode(note);
}
sRet=this.ctrl.encode(panelInfo.getName()) + ";" + link + ";" +
this.ctrl.encode(panelInfo.getId()) + ";" + this.ctrl.encode(this.panelInfo.getMdp()) + ";" +
note;
this.ctrl.ajouterCompte(sRet);
this.dispose();
this.ctrl.actualisationDeux();
}
}
}