-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexamplez_pwd.java
72 lines (56 loc) · 2.18 KB
/
examplez_pwd.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
import javax.swing.GroupLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.EventQueue;
import static javax.swing.GroupLayout.Alignment.BASELINE;
import static javax.swing.GroupLayout.Alignment.TRAILING;
public class GroupLayoutPasswordEx extends JFrame {
public GroupLayoutPasswordEx() {
initUI();
}
private void initUI() {
var pane = getContentPane();
var gl = new GroupLayout(pane);
pane.setLayout(gl);
var serviceLbl = new JLabel("Service:");
var userNameLbl = new JLabel("User name:");
var passwordLbl = new JLabel("Password:");
var field1 = new JTextField(10);
var field2 = new JTextField(10);
var field3 = new JTextField(10);
gl.setAutoCreateGaps(true);
gl.setAutoCreateContainerGaps(true);
gl.setHorizontalGroup(gl.createSequentialGroup()
.addGroup(gl.createParallelGroup(TRAILING)
.addComponent(serviceLbl)
.addComponent(userNameLbl)
.addComponent(passwordLbl))
.addGroup(gl.createParallelGroup()
.addComponent(field1)
.addComponent(field2)
.addComponent(field3))
);
gl.setVerticalGroup(gl.createSequentialGroup()
.addGroup(gl.createParallelGroup(BASELINE)
.addComponent(serviceLbl)
.addComponent(field1))
.addGroup(gl.createParallelGroup(BASELINE)
.addComponent(userNameLbl)
.addComponent(field2))
.addGroup(gl.createParallelGroup(BASELINE)
.addComponent(passwordLbl)
.addComponent(field3))
);
pack();
setTitle("Password application");
setLocationRelativeTo(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
EventQueue.invokeLater(() -> {
var ex = new GroupLayoutPasswordEx();
ex.setVisible(true);
});
}
}