KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SnowMailClient > view > accounts > AddAccountWizzardDialog


1 package SnowMailClient.view.accounts;
2
3 import SnowMailClient.model.accounts.*;
4 import SnowMailClient.model.Address;
5 import SnowMailClient.view.actions.*;
6 import SnowMailClient.utils.storage.*;
7 import snow.utils.gui.*;
8 import SnowMailClient.view.dialogs.*;
9 import SnowMailClient.Language.*;
10
11 import javax.swing.*;
12 import javax.swing.border.*;
13 import javax.swing.event.*;
14 import java.awt.*;
15 import java.awt.event.*;
16
17 // MODAL
18
public class AddAccountWizzardDialog extends JDialog
19 {
20   JTextField mailAddressTF = new JTextField("", 22);
21   JPasswordField passwordTF = new JPasswordField(22);
22   CloseControlPanel ccp;
23
24   public AddAccountWizzardDialog(JDialog parent)
25   {
26      super(parent, "Add a mail account", true);
27
28      getContentPane().setLayout(new BorderLayout());
29
30      ccp = new CloseControlPanel(this, true, true, Language.translate("Add the new account"));
31      ccp.getOkButton().setIcon(Icons.PlusIcon.shared10);
32      getContentPane().add(ccp, BorderLayout.SOUTH);
33
34      JPanel inputPanel = new JPanel(new GridLayout(2,2,3,3));
35      getContentPane().add(inputPanel, BorderLayout.CENTER);
36      inputPanel.setBorder(new EmptyBorder(5,5,5,5));
37
38      inputPanel.add(new JLabel(Language.translate("Mail address")+": "));
39      inputPanel.add(mailAddressTF);
40
41      inputPanel.add(new JLabel(Language.translate("Password")+": "));
42      inputPanel.add(passwordTF);
43
44      this.pack();
45      this.setLocationRelativeTo(this.getOwner());
46
47      // modal
48
this.setVisible(true);
49   }
50
51   public Address getMailAddress() { return new Address(mailAddressTF.getText()); }
52   public boolean wasDialogCancelled() { return ccp.getWasCancelled(); }
53   public String JavaDoc getPassword() { return new String JavaDoc(passwordTF.getPassword()); }
54
55 }
Popular Tags