-
Notifications
You must be signed in to change notification settings - Fork 0
/
VerificationDlg.java
105 lines (74 loc) · 2.19 KB
/
VerificationDlg.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Pass Application Version 1
// VerificationDlg.java
// Dave Shean - March 18, 1999
import javax.swing.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;
class VerificationDlg extends CenterDlg implements ActionListener {
TextField passField;
List ptList;
GridBagConstraints cns;
JButton okButton;
JButton cancelButton;
JPanel dlgPanel;
JFrame par;
String pwd;
VerificationDlg(JFrame par, String pwd) {
super(par, "Password Keeper - Enter Password", true); // Modal Dialog
this.par = par;
this.pwd = pwd;
okButton = new JButton("OK");
okButton.addActionListener(this);
dlgPanel = new JPanel();
dlgPanel.setLayout(new GridBagLayout());
cns = new GridBagConstraints();
cns.gridx = cns.gridy = 0;
cns.insets = new Insets(2,2,2,2);
dlgPanel.add(new JLabel("Password"), cns);
cns.gridx++;
passField = new TextField(30);
dlgPanel.add(passField, cns);
cns.gridy++;
//cns.gridx = 0;
dlgPanel.add(okButton, cns);
cancelButton = new JButton("Cancel");
cns.gridx++;
dlgPanel.add(cancelButton, cns);
Container cp = this.getContentPane();
Border rb = BorderFactory.createEtchedBorder();
dlgPanel.setBorder(BorderFactory.createTitledBorder(rb,
"Enter Password", TitledBorder.LEFT, TitledBorder.TOP));
cp.add(dlgPanel);
pack();
}
public void actionPerformed(ActionEvent evt) {
Object src = evt.getSource();
if (src == okButton) {
System.out.println("OK pressed");
doOk();
setVisible(false);
dispose();
}
else {
//doCancel();
setVisible(false);
dispose();
}
}
protected void doOk() {
if (pwd != null) {
if (passField.getText().equals(pwd)) {
((PassWindow)par).passWord = passField.getText();
((PassWindow)par).setVisible(true);
}
else
{
}
}
else {
((PassWindow)par).passWord = passField.getText();
((PassWindow)par).setVisible(true);
}
}
}