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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
| public class CreateForm extends JFrame implements ActionListener {
SpringLayout sl = new SpringLayout();
JPanel panel = new JPanel(sl);
JLabel jlFormSp; // форма справки
JButton searchJB;
JComboBox jtFormSp; // форма справки
JLabel jlNumberSp; // номер справки
JTextField jtNumberSp; // номер справки
JCheckBox jCBox; //автомат номера справки
JLabel jlDateSp; // дата справки
String[] days = {"01","02","03","04","05","06","07","08","09","10",
"11","12","13","14","15","16","17","18","19","20",
"21","22","23","24","25","26","27","28","29","30","31"};
String [] months = {"января", "февраля", "марта", "апреля","мая",
"июня", "июля", "августа", "сентября", "октября",
"ноября", "декабря"};
String[] forms = {"1","2","3"};
String[] wFromSp = {"первой форме", "второй форме", "третьей форме"};
String[] litFormSp = {"А/","Б/","Д/"};
JComboBox<?> daysJCB; // список дней
JComboBox<?> monthsJCB; // список месяцев
JTextField yearsJTF; // поле год
JTextField secondNameJTF; // Фамилия
JLabel secondNameJL; // Фамилия
JTextField nameJTF; // Имя
JLabel nameJL; //Имя
JTextField fatherNameJTF; // Отчество
JLabel fatherNameJL; // Отчество
JLabel numDopJL; // Номер допуска
JTextField numDopJTF; // Номер допуска
JLabel whatDateJL;
JComboBox<?> whatDateDayJCB;
JComboBox<?> whatDateMonthJCB;
JTextField whatDateYearJTF;
JLabel whatDateAcceptJL;
JComboBox<?> whatDateAcceptDayJCB;
JComboBox<?> whatDateAcceptMonthJCB;
JTextField whatDateAcceptYearJTF;
JLabel whatFinDateJL;
JComboBox<?> whatFinDateDayJCB;
JComboBox<?> whatFinDateMonthJCB;
JTextField whatFinDateYearJTF;
JLabel whatFormSpJL;
JComboBox<?> whatFormSpJCB;
JComboBox<?> litDopJCB;
String formSpCF;
String whatFormSpCF;
String numberSpCF;
String daysSpCF;
String monthsSpCF;
String litDopCF;
String whatDaysDopCF;
String whatMonthsDopCF;
String wDateAcceptDayCF;
String wDateAcceptMonthCF;
String wDateFinDayCF;
String wDateFinMonthCF;
public CreateForm(String string) {
setSize(1000, 800);
setLocation(200, 200);
panel.setSize(100, 50);
panel.add(jlFormSp = new JLabel("Форма справки"));
panel.add(jlNumberSp = new JLabel("Номер справки"));
panel.add(jtFormSp = new JComboBox (forms)); // форма справки
panel.add(jtNumberSp = new JTextField (4)); // номер справки
panel.add(jCBox = new JCheckBox("Автоматически")); jCBox.setEnabled(true); // автомат номера справки
panel.add(jlDateSp = new JLabel("Дата создания справки"));
panel.add(daysJCB = new JComboBox<Object>(days)); // дни даты
panel.add(monthsJCB = new JComboBox<Object>(months)); // месяцы даты
panel.add(yearsJTF = new JTextField(4));
panel.add(secondNameJTF = new JTextField(20));
panel.add(secondNameJL = new JLabel("Фамилия"));
panel.add(nameJTF = new JTextField(20));
panel.add(nameJL = new JLabel("Имя"));
panel.add(fatherNameJTF = new JTextField(20));
panel.add(fatherNameJL = new JLabel("Отчество"));
panel.add(searchJB = new JButton("Создать форму"));
panel.add(numDopJL = new JLabel("Номер допуска"));
panel.add(numDopJTF = new JTextField(10));
panel.add(whatDateJL = new JLabel("от..."));
panel.add(whatDateDayJCB = new JComboBox<Object>(days));
panel.add(whatDateMonthJCB = new JComboBox<Object>(months));
panel.add(whatDateYearJTF = new JTextField(5));
panel.add(whatDateAcceptJL = new JLabel("Дата утверждения"));
panel.add(whatDateAcceptDayJCB = new JComboBox(days));
panel.add(whatDateAcceptMonthJCB = new JComboBox<Object>(months));
panel.add(whatDateAcceptYearJTF = new JTextField(5));
panel.add(whatFinDateJL = new JLabel("Дата окончания справки"));
panel.add(whatFinDateDayJCB = new JComboBox<Object>(days));
panel.add(whatFinDateMonthJCB = new JComboBox<Object>(months));
panel.add(whatFinDateYearJTF = new JTextField(5));
panel.add(whatFormSpJCB = new JComboBox<Object>(wFromSp));
panel.add(whatFormSpJL = new JLabel("создать справку по ..."));
panel.add(litDopJCB = new JComboBox<Object>(litFormSp));
sl.putConstraint(SpringLayout.WEST, jlFormSp, 15, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, jlFormSp, 15, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, jtFormSp, 130, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, jtFormSp, 15, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, jlNumberSp, 50, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, jlNumberSp, 15, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, jtNumberSp, 50, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, jtNumberSp, 130, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, jCBox, 90, SpringLayout.WEST,panel);
sl.putConstraint(SpringLayout.WEST, jCBox, 350, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, jlDateSp, 90, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, jlDateSp, 15, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, daysJCB, 90, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, daysJCB, 160, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, monthsJCB, 90, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, monthsJCB, 210, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, yearsJTF, 90, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, yearsJTF, 300, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, secondNameJL, 15, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, secondNameJL, 130, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, secondNameJTF, 130, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, secondNameJTF, 130, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, nameJL, 15, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, nameJL, 170, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, nameJTF, 170, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, nameJTF, 130, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, fatherNameJL, 210, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, fatherNameJL, 15, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, fatherNameJTF, 210, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, fatherNameJTF, 130, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, numDopJL, 250, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, numDopJL, 15, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, numDopJTF, 250, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, numDopJTF, 180, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, whatDateJL, 250, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, whatDateJL, 320, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, whatDateDayJCB, 250, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, whatDateDayJCB, 360, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, whatDateMonthJCB, 250, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, whatDateMonthJCB, 410, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, whatDateYearJTF, 500, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, whatDateYearJTF, 250, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, whatDateAcceptJL, 245, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, whatDateAcceptJL, 300, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, whatDateAcceptDayJCB, 300, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, whatDateAcceptDayJCB,360, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, whatDateAcceptMonthJCB, 300, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, whatDateAcceptMonthJCB, 410, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, whatDateAcceptYearJTF, 300, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, whatDateAcceptYearJTF, 500, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, whatFinDateJL, 350, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, whatFinDateJL, 15, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, whatFinDateDayJCB, 350, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, whatFinDateDayJCB, 200, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, whatFinDateMonthJCB, 350, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, whatFinDateMonthJCB, 250, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, whatFinDateYearJTF, 350, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, whatFinDateYearJTF, 340, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, whatFormSpJCB, 15, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, whatFormSpJCB, 320, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, whatFormSpJL, 15, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, whatFormSpJL, 190, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, litDopJCB, 250, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, litDopJCB, 130, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.NORTH, searchJB, 400, SpringLayout.WEST, panel);
sl.putConstraint(SpringLayout.WEST, searchJB, 25, SpringLayout.WEST, panel);
formSpCF = (String) jtFormSp.getSelectedItem();
whatFormSpCF = (String) whatFormSpJCB.getSelectedItem();
daysSpCF = (String) daysJCB.getSelectedItem();
monthsSpCF = (String) monthsJCB.getSelectedItem();
litDopCF = (String) litDopJCB.getSelectedItem();
whatDaysDopCF = (String) whatDateDayJCB.getSelectedItem();
whatMonthsDopCF = (String) whatDateMonthJCB.getSelectedItem();
wDateAcceptDayCF = (String) whatDateAcceptDayJCB.getSelectedItem();
wDateAcceptMonthCF = (String) whatDateAcceptMonthJCB.getSelectedItem();
wDateFinDayCF = (String) whatFinDateDayJCB.getSelectedItem();
wDateFinMonthCF = (String) whatFinDateMonthJCB.getSelectedItem();
searchJB.addActionListener(this);
setContentPane(panel);
setVisible(true);
}
public void actionPerformed(ActionEvent sjb) {
if (sjb.getActionCommand().equals("Создать форму")){
new FillForm(this);
}
}
} |