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 | |
package com.buckosoft.fibs.BuckoFIBS.gui.account; |
54 | |
|
55 | |
import java.awt.Color; |
56 | |
import java.awt.Dimension; |
57 | |
import java.awt.Font; |
58 | |
import java.awt.GridBagConstraints; |
59 | |
import java.awt.GridBagLayout; |
60 | |
import java.awt.Insets; |
61 | |
import java.awt.SystemColor; |
62 | |
import java.util.regex.Pattern; |
63 | |
|
64 | |
import javax.swing.BorderFactory; |
65 | |
import javax.swing.JButton; |
66 | |
import javax.swing.JDialog; |
67 | |
import javax.swing.JFrame; |
68 | |
import javax.swing.JLabel; |
69 | |
import javax.swing.JPanel; |
70 | |
import javax.swing.JPasswordField; |
71 | |
import javax.swing.JTextArea; |
72 | |
import javax.swing.JTextField; |
73 | |
import javax.swing.JTextPane; |
74 | |
import javax.swing.border.TitledBorder; |
75 | |
|
76 | |
import com.buckosoft.fibs.BuckoFIBS.BFProperties; |
77 | |
import com.buckosoft.fibs.BuckoFIBS.CommandDispatcher; |
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | 0 | public class CreateAccountDialog extends JDialog implements CreateAccountStatusInterface, ProfileSelectorNotifier { |
86 | |
private static final long serialVersionUID = 1L; |
87 | |
private CommandDispatcher commandDispatcher; |
88 | |
private BFProperties properties; |
89 | 0 | Pattern pat = Pattern.compile("[A-Za-z_]+"); |
90 | |
|
91 | 0 | private JPanel jPanel = null; |
92 | 0 | private JPanel jPanel1 = null; |
93 | 0 | private JPanel jPanel2 = null; |
94 | 0 | private JLabel jLabel = null; |
95 | 0 | private JLabel jLabel1 = null; |
96 | 0 | private JTextField jTextFieldUserName = null; |
97 | 0 | private JLabel jLabel2 = null; |
98 | 0 | private JLabel jLabel3 = null; |
99 | 0 | private JPasswordField jPasswordField0 = null; |
100 | 0 | private JLabel jLabel4 = null; |
101 | 0 | private JPanel jPanelPasswordLabel = null; |
102 | 0 | private JLabel jLabel5 = null; |
103 | 0 | private JPasswordField jPasswordField1 = null; |
104 | 0 | private JButton jButtonCreate = null; |
105 | 0 | private JButton jButtonCancel = null; |
106 | 0 | private JPanel jButtonPanel = null; |
107 | 0 | private JPanel jPanelStatus = null; |
108 | 0 | private JTextArea jTextAreaStatus = null; |
109 | 0 | private ProfileSelectorPanel jPanelProfile = null; |
110 | 0 | private JLabel jLabelProfile = null; |
111 | 0 | private JTextPane jTextPaneStatus = null; |
112 | 0 | private ServerPortSelectorPanel jPanelServerSelector = null; |
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
public CreateAccountDialog() { |
118 | 0 | super(); |
119 | 0 | initialize(); |
120 | 0 | } |
121 | |
|
122 | |
public CreateAccountDialog(JFrame owner, CommandDispatcher commandDispatcher) { |
123 | 0 | super(owner, true); |
124 | 0 | this.commandDispatcher = commandDispatcher; |
125 | 0 | this.properties = commandDispatcher.getProperties(); |
126 | 0 | initialize(); |
127 | 0 | this.setLocationRelativeTo(owner); |
128 | 0 | boolean b = this.properties.isAllowMultiplePersonalities(); |
129 | 0 | this.jPanelProfile.setVisible(b); |
130 | 0 | this.jLabelProfile.setVisible(b); |
131 | 0 | if (this.properties.isNewbie()) { |
132 | 0 | this.jPanelProfile.setVisible(false); |
133 | 0 | this.jLabelProfile.setVisible(false); |
134 | 0 | this.jLabel2.setVisible(false); |
135 | 0 | this.getJPanelServerSelector().setVisible(false); |
136 | |
} |
137 | 0 | } |
138 | |
|
139 | |
|
140 | |
|
141 | |
|
142 | |
|
143 | |
|
144 | |
private void initialize() { |
145 | 0 | this.setSize(new Dimension(407, 294)); |
146 | 0 | this.setContentPane(getJPanel()); |
147 | 0 | this.setTitle("Create New Account"); |
148 | |
|
149 | 0 | } |
150 | |
|
151 | |
private void createNewAccountButtonActionPerformed(java.awt.event.ActionEvent evt) { |
152 | 0 | int profileId = this.jPanelProfile.getSelectedProfile(); |
153 | |
|
154 | 0 | this.properties.setUserName(profileId, this.jTextFieldUserName.getText()); |
155 | 0 | this.properties.setPassword(profileId, new String(this.jPasswordField0.getPassword())); |
156 | 0 | commandDispatcher.dispatch(CommandDispatcher.Command.REGISTER_NEW_USER, this); |
157 | 0 | } |
158 | |
|
159 | |
private void cancelButtonAction() { |
160 | 0 | this.setVisible(false); |
161 | 0 | dispose(); |
162 | 0 | commandDispatcher.dispatch(CommandDispatcher.Command.SHOW_CONNECTION_DIALOG); |
163 | 0 | } |
164 | |
|
165 | |
private void userNameKeyTyped(java.awt.event.KeyEvent evt) { |
166 | 0 | checkActivateCreate(); |
167 | |
|
168 | 0 | } |
169 | |
private void password0KeyTyped(java.awt.event.KeyEvent evt) { |
170 | 0 | checkActivateCreate(); |
171 | |
|
172 | 0 | } |
173 | |
private void password1KeyTyped(java.awt.event.KeyEvent evt) { |
174 | 0 | checkActivateCreate(); |
175 | 0 | } |
176 | |
|
177 | |
private void caretChanged(javax.swing.event.CaretEvent e) { |
178 | 0 | checkActivateCreate(); |
179 | |
|
180 | 0 | } |
181 | |
private void checkActivateCreate() { |
182 | 0 | if (this.jButtonCreate == null) |
183 | 0 | return; |
184 | 0 | this.jButtonCreate.setEnabled(false); |
185 | 0 | String userName = this.jTextFieldUserName.getText(); |
186 | 0 | if (userName.length() < 3) { |
187 | 0 | setStatus("User Name must be at least 3 characters"); |
188 | 0 | return; |
189 | |
} |
190 | 0 | if (!pat.matcher(userName).matches()) { |
191 | 0 | setStatus("Username can have only upper and lower case letters and the underscore"); |
192 | 0 | return; |
193 | |
} |
194 | 0 | char[] password = this.jPasswordField0.getPassword(); |
195 | 0 | if (password.length == 0) { |
196 | 0 | setStatus("Enter a password"); |
197 | 0 | return; |
198 | |
} |
199 | 0 | char[] password1 = this.jPasswordField1.getPassword(); |
200 | 0 | if (password1.length == 0) { |
201 | 0 | setStatus("Enter your password again"); |
202 | 0 | return; |
203 | |
} |
204 | 0 | boolean passwordMismatch = false; |
205 | 0 | if (password.length != password1.length) |
206 | 0 | passwordMismatch = true; |
207 | |
else { |
208 | 0 | for (int i=0; i<password.length; i++) |
209 | 0 | if (password[i] != password1[i]) { |
210 | 0 | passwordMismatch = true; |
211 | 0 | break; |
212 | |
} |
213 | |
} |
214 | 0 | if (passwordMismatch) { |
215 | 0 | setStatus("You must enter the same password twice"); |
216 | 0 | return; |
217 | |
} |
218 | 0 | setStatus(""); |
219 | 0 | this.jButtonCreate.setEnabled(true); |
220 | 0 | } |
221 | |
|
222 | |
public void setStatus(String s) { |
223 | 0 | this.jTextPaneStatus.setText(s); |
224 | 0 | } |
225 | |
|
226 | |
|
227 | |
|
228 | |
|
229 | |
@Override |
230 | |
public void onRegisterFailure() { |
231 | 0 | this.jButtonCreate.setEnabled(false); |
232 | 0 | } |
233 | |
|
234 | |
|
235 | |
|
236 | |
|
237 | |
@Override |
238 | |
public void onRegisterSuccess() { |
239 | 0 | this.setVisible(false); |
240 | 0 | dispose(); |
241 | 0 | } |
242 | |
|
243 | |
|
244 | |
|
245 | |
|
246 | |
@Override |
247 | |
public void profileChanged() { |
248 | 0 | int profileId = this.properties.getSelectedProfile(); |
249 | 0 | this.jTextFieldUserName.setText(this.properties.getUserName(profileId)); |
250 | 0 | this.jPasswordField0.setText(this.properties.getPassword(profileId)); |
251 | 0 | this.jPasswordField1.setText(this.properties.getPassword(profileId)); |
252 | 0 | if (this.jPanelServerSelector != null) |
253 | 0 | this.jPanelServerSelector.setServerName(this.properties.getServerName(profileId)); |
254 | 0 | } |
255 | |
|
256 | |
|
257 | |
|
258 | |
|
259 | |
|
260 | |
|
261 | |
private JPanel getJPanel() { |
262 | 0 | if (jPanel == null) { |
263 | 0 | GridBagConstraints gridBagConstraints18 = new GridBagConstraints(); |
264 | 0 | gridBagConstraints18.fill = GridBagConstraints.BOTH; |
265 | 0 | gridBagConstraints18.gridy = 2; |
266 | 0 | gridBagConstraints18.weightx = 1.0; |
267 | 0 | gridBagConstraints18.weighty = 1.0; |
268 | 0 | gridBagConstraints18.gridx = 0; |
269 | 0 | GridBagConstraints gridBagConstraints31 = new GridBagConstraints(); |
270 | 0 | gridBagConstraints31.gridx = 0; |
271 | 0 | gridBagConstraints31.fill = GridBagConstraints.BOTH; |
272 | 0 | gridBagConstraints31.weighty = 1.0; |
273 | 0 | gridBagConstraints31.gridy = 3; |
274 | 0 | GridBagConstraints gridBagConstraints21 = new GridBagConstraints(); |
275 | 0 | gridBagConstraints21.gridx = 0; |
276 | 0 | gridBagConstraints21.fill = GridBagConstraints.HORIZONTAL; |
277 | 0 | gridBagConstraints21.weightx = 0.0; |
278 | 0 | gridBagConstraints21.insets = new Insets(4, 0, 4, 0); |
279 | 0 | gridBagConstraints21.gridy = 3; |
280 | 0 | jLabel1 = new JLabel(); |
281 | 0 | jLabel1.setText("User Name:"); |
282 | 0 | jLabel = new JLabel(); |
283 | 0 | jLabel.setText("Create a new account on FIBS. "); |
284 | 0 | GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
285 | 0 | gridBagConstraints.gridx = 0; |
286 | 0 | gridBagConstraints.weighty = 2.0; |
287 | 0 | gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
288 | 0 | gridBagConstraints.weightx = 1.0; |
289 | 0 | gridBagConstraints.gridy = 1; |
290 | 0 | GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
291 | 0 | gridBagConstraints1.gridx = 0; |
292 | 0 | gridBagConstraints1.fill = GridBagConstraints.BOTH; |
293 | 0 | gridBagConstraints1.gridwidth = 1; |
294 | 0 | gridBagConstraints1.weightx = 1.0; |
295 | 0 | gridBagConstraints1.gridy = 0; |
296 | 0 | jPanel = new JPanel(); |
297 | 0 | jPanel.setLayout(new GridBagLayout()); |
298 | 0 | jPanel.add(getJPanel1(), gridBagConstraints1); |
299 | 0 | jPanel.add(getJPanel2(), gridBagConstraints); |
300 | 0 | jPanel.add(getJButtonPanel(), gridBagConstraints21); |
301 | 0 | jPanel.add(getJPanelStatus(), gridBagConstraints31); |
302 | 0 | jPanel.add(getJTextPaneStatus(), gridBagConstraints18); |
303 | |
} |
304 | 0 | return jPanel; |
305 | |
} |
306 | |
|
307 | |
|
308 | |
|
309 | |
|
310 | |
|
311 | |
|
312 | |
private JPanel getJPanel1() { |
313 | 0 | if (jPanel1 == null) { |
314 | 0 | GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
315 | 0 | gridBagConstraints2.gridx = -1; |
316 | 0 | gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL; |
317 | 0 | gridBagConstraints2.anchor = GridBagConstraints.CENTER; |
318 | 0 | gridBagConstraints2.gridy = -1; |
319 | 0 | jPanel1 = new JPanel(); |
320 | 0 | jPanel1.setLayout(new GridBagLayout()); |
321 | 0 | jPanel1.add(jLabel, gridBagConstraints2); |
322 | |
} |
323 | 0 | return jPanel1; |
324 | |
} |
325 | |
|
326 | |
|
327 | |
|
328 | |
|
329 | |
|
330 | |
|
331 | |
private JPanel getJPanel2() { |
332 | 0 | if (jPanel2 == null) { |
333 | 0 | GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); |
334 | 0 | gridBagConstraints6.gridx = 1; |
335 | 0 | gridBagConstraints6.gridy = 1; |
336 | 0 | GridBagConstraints gridBagConstraints17 = new GridBagConstraints(); |
337 | 0 | gridBagConstraints17.gridx = 0; |
338 | 0 | gridBagConstraints17.anchor = GridBagConstraints.EAST; |
339 | 0 | gridBagConstraints17.gridy = 0; |
340 | 0 | jLabelProfile = new JLabel(); |
341 | 0 | jLabelProfile.setText("Select Profile:"); |
342 | 0 | GridBagConstraints gridBagConstraints16 = new GridBagConstraints(); |
343 | 0 | gridBagConstraints16.gridx = 1; |
344 | 0 | gridBagConstraints16.fill = GridBagConstraints.HORIZONTAL; |
345 | 0 | gridBagConstraints16.gridy = 0; |
346 | 0 | GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); |
347 | 0 | gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL; |
348 | 0 | gridBagConstraints12.gridy = 5; |
349 | 0 | gridBagConstraints12.weightx = 1.0; |
350 | 0 | gridBagConstraints12.insets = new Insets(4, 4, 4, 0); |
351 | 0 | gridBagConstraints12.gridx = 1; |
352 | 0 | GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); |
353 | 0 | gridBagConstraints11.gridx = 0; |
354 | 0 | gridBagConstraints11.gridy = 1; |
355 | 0 | GridBagConstraints gridBagConstraints10 = new GridBagConstraints(); |
356 | 0 | gridBagConstraints10.gridx = 0; |
357 | 0 | gridBagConstraints10.gridy = 5; |
358 | 0 | jLabel4 = new JLabel(); |
359 | 0 | jLabel4.setText("Repeat"); |
360 | 0 | GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); |
361 | 0 | gridBagConstraints8.fill = GridBagConstraints.BOTH; |
362 | 0 | gridBagConstraints8.gridy = 3; |
363 | 0 | gridBagConstraints8.weightx = 1.0; |
364 | 0 | gridBagConstraints8.insets = new Insets(4, 4, 4, 0); |
365 | 0 | gridBagConstraints8.gridx = 1; |
366 | 0 | GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); |
367 | 0 | gridBagConstraints7.gridx = 0; |
368 | 0 | gridBagConstraints7.anchor = GridBagConstraints.EAST; |
369 | 0 | gridBagConstraints7.gridy = 3; |
370 | 0 | jLabel3 = new JLabel(); |
371 | 0 | jLabel3.setText("Password:"); |
372 | 0 | GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
373 | 0 | gridBagConstraints5.gridx = 0; |
374 | 0 | gridBagConstraints5.anchor = GridBagConstraints.EAST; |
375 | 0 | gridBagConstraints5.gridy = 1; |
376 | 0 | jLabel2 = new JLabel(); |
377 | 0 | jLabel2.setText("Server:"); |
378 | 0 | GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); |
379 | 0 | gridBagConstraints4.fill = GridBagConstraints.BOTH; |
380 | 0 | gridBagConstraints4.gridy = 2; |
381 | 0 | gridBagConstraints4.weightx = 1.0; |
382 | 0 | gridBagConstraints4.insets = new Insets(4, 4, 4, 0); |
383 | 0 | gridBagConstraints4.gridx = -1; |
384 | 0 | GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
385 | 0 | gridBagConstraints3.gridx = -1; |
386 | 0 | gridBagConstraints3.anchor = GridBagConstraints.EAST; |
387 | 0 | gridBagConstraints3.gridy = 2; |
388 | 0 | jPanel2 = new JPanel(); |
389 | 0 | jPanel2.setLayout(new GridBagLayout()); |
390 | 0 | jPanel2.add(jLabel1, gridBagConstraints3); |
391 | 0 | jPanel2.add(getJTextFieldUserName(), gridBagConstraints4); |
392 | 0 | jPanel2.add(jLabel2, gridBagConstraints5); |
393 | 0 | jPanel2.add(jLabel3, gridBagConstraints7); |
394 | 0 | jPanel2.add(getJPasswordField0(), gridBagConstraints8); |
395 | 0 | jPanel2.add(getJPanelPasswordLabel(), gridBagConstraints10); |
396 | 0 | jPanel2.add(getJPasswordField1(), gridBagConstraints12); |
397 | 0 | jPanel2.add(getJPanelProfile(), gridBagConstraints16); |
398 | 0 | jPanel2.add(jLabelProfile, gridBagConstraints17); |
399 | 0 | jPanel2.add(getJPanelServerSelector(), gridBagConstraints6); |
400 | |
} |
401 | 0 | return jPanel2; |
402 | |
} |
403 | |
|
404 | |
|
405 | |
|
406 | |
|
407 | |
|
408 | |
|
409 | |
private JTextField getJTextFieldUserName() { |
410 | 0 | if (jTextFieldUserName == null) { |
411 | 0 | jTextFieldUserName = new JTextField(); |
412 | 0 | jTextFieldUserName.addKeyListener(new java.awt.event.KeyAdapter() { |
413 | |
public void keyTyped(java.awt.event.KeyEvent e) { |
414 | 0 | userNameKeyTyped(e); |
415 | 0 | } |
416 | |
}); |
417 | 0 | jTextFieldUserName.addCaretListener(new javax.swing.event.CaretListener() { |
418 | |
public void caretUpdate(javax.swing.event.CaretEvent e) { |
419 | 0 | caretChanged(e); |
420 | 0 | } |
421 | |
}); |
422 | |
} |
423 | 0 | return jTextFieldUserName; |
424 | |
} |
425 | |
|
426 | |
|
427 | |
|
428 | |
|
429 | |
|
430 | |
|
431 | |
private JPasswordField getJPasswordField0() { |
432 | 0 | if (jPasswordField0 == null) { |
433 | 0 | jPasswordField0 = new JPasswordField(); |
434 | 0 | jPasswordField0.addKeyListener(new java.awt.event.KeyAdapter() { |
435 | |
public void keyTyped(java.awt.event.KeyEvent e) { |
436 | 0 | password0KeyTyped(e); |
437 | 0 | } |
438 | |
}); |
439 | 0 | jPasswordField0.addCaretListener(new javax.swing.event.CaretListener() { |
440 | |
public void caretUpdate(javax.swing.event.CaretEvent e) { |
441 | 0 | caretChanged(e); |
442 | 0 | } |
443 | |
}); |
444 | |
} |
445 | 0 | return jPasswordField0; |
446 | |
} |
447 | |
|
448 | |
|
449 | |
|
450 | |
|
451 | |
|
452 | |
|
453 | |
private JPanel getJPanelPasswordLabel() { |
454 | 0 | if (jPanelPasswordLabel == null) { |
455 | 0 | jLabel5 = new JLabel(); |
456 | 0 | jLabel5.setText("Password:"); |
457 | 0 | GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); |
458 | 0 | gridBagConstraints9.gridx = 0; |
459 | 0 | gridBagConstraints9.anchor = GridBagConstraints.EAST; |
460 | 0 | gridBagConstraints9.gridy = 0; |
461 | 0 | GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); |
462 | 0 | gridBagConstraints11.gridx = 0; |
463 | 0 | gridBagConstraints11.anchor = GridBagConstraints.EAST; |
464 | 0 | gridBagConstraints11.gridy = 1; |
465 | 0 | jPanelPasswordLabel = new JPanel(); |
466 | 0 | jPanelPasswordLabel.setLayout(new GridBagLayout()); |
467 | 0 | jPanelPasswordLabel.add(jLabel4, gridBagConstraints9); |
468 | 0 | jPanelPasswordLabel.add(jLabel5, gridBagConstraints11); |
469 | |
} |
470 | 0 | return jPanelPasswordLabel; |
471 | |
} |
472 | |
|
473 | |
|
474 | |
|
475 | |
|
476 | |
|
477 | |
|
478 | |
private JPasswordField getJPasswordField1() { |
479 | 0 | if (jPasswordField1 == null) { |
480 | 0 | jPasswordField1 = new JPasswordField(); |
481 | 0 | jPasswordField1.addKeyListener(new java.awt.event.KeyAdapter() { |
482 | |
public void keyTyped(java.awt.event.KeyEvent e) { |
483 | 0 | password1KeyTyped(e); |
484 | 0 | } |
485 | |
}); |
486 | 0 | jPasswordField1.addCaretListener(new javax.swing.event.CaretListener() { |
487 | |
public void caretUpdate(javax.swing.event.CaretEvent e) { |
488 | 0 | caretChanged(e); |
489 | 0 | } |
490 | |
}); |
491 | |
} |
492 | 0 | return jPasswordField1; |
493 | |
} |
494 | |
|
495 | |
|
496 | |
|
497 | |
|
498 | |
|
499 | |
|
500 | |
private JButton getJButtonCreate() { |
501 | 0 | if (jButtonCreate == null) { |
502 | 0 | jButtonCreate = new JButton(); |
503 | 0 | jButtonCreate.setText("Create Account"); |
504 | 0 | jButtonCreate.setEnabled(false); |
505 | 0 | jButtonCreate.addActionListener(new java.awt.event.ActionListener() { |
506 | |
public void actionPerformed(java.awt.event.ActionEvent e) { |
507 | 0 | createNewAccountButtonActionPerformed(e); |
508 | 0 | } |
509 | |
}); |
510 | |
} |
511 | 0 | return jButtonCreate; |
512 | |
} |
513 | |
|
514 | |
|
515 | |
|
516 | |
|
517 | |
|
518 | |
|
519 | |
private JButton getJButtonCancel() { |
520 | 0 | if (jButtonCancel == null) { |
521 | 0 | jButtonCancel = new JButton(); |
522 | 0 | jButtonCancel.setText("Cancel"); |
523 | 0 | jButtonCancel.addActionListener(new java.awt.event.ActionListener() { |
524 | |
public void actionPerformed(java.awt.event.ActionEvent e) { |
525 | 0 | cancelButtonAction(); |
526 | 0 | } |
527 | |
}); |
528 | |
} |
529 | 0 | return jButtonCancel; |
530 | |
} |
531 | |
|
532 | |
|
533 | |
|
534 | |
|
535 | |
|
536 | |
|
537 | |
private JPanel getJButtonPanel() { |
538 | 0 | if (jButtonPanel == null) { |
539 | 0 | GridBagConstraints gridBagConstraints13 = new GridBagConstraints(); |
540 | 0 | gridBagConstraints13.gridx = -1; |
541 | 0 | gridBagConstraints13.weightx = 0.5; |
542 | 0 | gridBagConstraints13.gridy = -1; |
543 | 0 | GridBagConstraints gridBagConstraints14 = new GridBagConstraints(); |
544 | 0 | gridBagConstraints14.insets = new Insets(0, 0, 0, 0); |
545 | 0 | gridBagConstraints14.gridy = -1; |
546 | 0 | gridBagConstraints14.weightx = 0.5; |
547 | 0 | gridBagConstraints14.gridx = -1; |
548 | 0 | jButtonPanel = new JPanel(); |
549 | 0 | jButtonPanel.setLayout(new GridBagLayout()); |
550 | 0 | jButtonPanel.add(getJButtonCreate(), gridBagConstraints14); |
551 | 0 | jButtonPanel.add(getJButtonCancel(), gridBagConstraints13); |
552 | |
} |
553 | 0 | return jButtonPanel; |
554 | |
} |
555 | |
|
556 | |
|
557 | |
|
558 | |
|
559 | |
|
560 | |
|
561 | |
private JPanel getJPanelStatus() { |
562 | 0 | if (jPanelStatus == null) { |
563 | 0 | GridBagConstraints gridBagConstraints15 = new GridBagConstraints(); |
564 | 0 | gridBagConstraints15.fill = GridBagConstraints.BOTH; |
565 | 0 | gridBagConstraints15.gridy = -1; |
566 | 0 | gridBagConstraints15.weightx = 1.0; |
567 | 0 | gridBagConstraints15.weighty = 1.0; |
568 | 0 | gridBagConstraints15.gridx = -1; |
569 | 0 | jPanelStatus = new JPanel(); |
570 | 0 | jPanelStatus.setLayout(new GridBagLayout()); |
571 | 0 | jPanelStatus.setBorder(BorderFactory.createTitledBorder(null, "Status", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); |
572 | 0 | jPanelStatus.setVisible(false); |
573 | 0 | jPanelStatus.add(getJTextAreaStatus(), gridBagConstraints15); |
574 | |
} |
575 | 0 | return jPanelStatus; |
576 | |
} |
577 | |
|
578 | |
|
579 | |
|
580 | |
|
581 | |
|
582 | |
|
583 | |
private JTextArea getJTextAreaStatus() { |
584 | 0 | if (jTextAreaStatus == null) { |
585 | 0 | jTextAreaStatus = new JTextArea(); |
586 | 0 | jTextAreaStatus.setLineWrap(true); |
587 | |
} |
588 | 0 | return jTextAreaStatus; |
589 | |
} |
590 | |
|
591 | |
|
592 | |
|
593 | |
|
594 | |
|
595 | |
|
596 | |
private ProfileSelectorPanel getJPanelProfile() { |
597 | 0 | if (jPanelProfile == null) { |
598 | 0 | jPanelProfile = new ProfileSelectorPanel(this, this, properties); |
599 | 0 | jPanelProfile.setLayout(new GridBagLayout()); |
600 | |
} |
601 | 0 | return jPanelProfile; |
602 | |
} |
603 | |
|
604 | |
|
605 | |
|
606 | |
|
607 | |
|
608 | |
|
609 | |
private JTextPane getJTextPaneStatus() { |
610 | 0 | if (jTextPaneStatus == null) { |
611 | 0 | jTextPaneStatus = new JTextPane(); |
612 | 0 | jTextPaneStatus.setBackground(SystemColor.controlHighlight); |
613 | 0 | jTextPaneStatus.setEditable(false); |
614 | |
} |
615 | 0 | return jTextPaneStatus; |
616 | |
} |
617 | |
|
618 | |
|
619 | |
|
620 | |
|
621 | |
|
622 | |
|
623 | |
private ServerPortSelectorPanel getJPanelServerSelector() { |
624 | 0 | if (jPanelServerSelector == null) { |
625 | 0 | jPanelServerSelector = new ServerPortSelectorPanel(properties); |
626 | 0 | jPanelServerSelector.setLayout(new GridBagLayout()); |
627 | |
} |
628 | 0 | return jPanelServerSelector; |
629 | |
} |
630 | |
|
631 | |
|
632 | |
} |