public Inscription() {
    labelName = new JLabel(" Nom : ");
    labelFirstName = new JLabel(" Prénom : ");
    labelLogin = new JLabel(" Login : "******" Mot de passe : ");
    labelPassword2 = new JLabel(" Confirmation mot de passe : ");
    labelAddress = new JLabel("\n Adresse : ");

    name = new JTextField(5);
    password = new JPasswordField(8);

    password.setEchoChar('*');
    password2 = new JPasswordField(8);

    password2.setEchoChar('*');

    firstName = new JTextField(5);
    address = new JTextField(30);

    this.add(labelPassword);
    this.add(password);
    this.add(labelPassword2);
    this.add(password2);

    this.add(labelName);
    this.add(name);
    this.add(labelFirstName);
    this.add(firstName);
    this.add(labelAddress);
    this.add(address);
  }
예제 #2
0
 /**
  * This method initializes jPasswordFieldPassword
  *
  * @return javax.swing.JPasswordField
  */
 private JPasswordField getJPasswordFieldPassword() {
   if (jPasswordFieldPassword == null) {
     jPasswordFieldPassword = new JPasswordField();
     jPasswordFieldPassword.setBounds(new Rectangle(377, 285, 180, 30));
     jPasswordFieldPassword.setText("");
     jPasswordFieldPassword.setToolTipText("Enter your password here");
     jPasswordFieldPassword.setEnabled(true);
     jPasswordFieldPassword.setEchoChar('*');
   }
   return jPasswordFieldPassword;
 }
예제 #3
0
 @Override
 public void setEchoChar(char c) {
   super.setEchoChar(c);
   ((AWTTextFieldUI) ui).installKeyboardActions();
 }
예제 #4
0
  public LoginDialog(String title) {
    super(title);

    JPanel topPanel = new JPanel(new GridLayout(3, 1));
    topPanel.setOpaque(false);
    emptyLabel = new JLabel();
    loginLabel = new JLabel("Login", JLabel.CENTER);
    loginLabel.setFont(new Font("Dialog", 1, 20));
    promptLabel = new JLabel("Connecting with server...", JLabel.CENTER);
    JPanel namePanel = new JPanel();
    namePanel.setOpaque(false);
    JPanel nameFieldPanel = new JPanel(new BorderLayout());
    nameFieldPanel.setOpaque(false);
    nameLabel = new JLabel("Username: "******"", 10);
    JPanel passwdPanel = new JPanel();
    passwdPanel.setOpaque(false);
    JPanel passwdFieldPanel = new JPanel(new BorderLayout());
    passwdFieldPanel.setOpaque(false);
    passwdLabel = new JLabel("Password: "******"", 10);
    passwdField.setEchoChar('*');
    JPanel rolePanel = new JPanel();
    rolePanel.setOpaque(false);
    JPanel roleBoxPanel = new JPanel(new BorderLayout());
    roleBoxPanel.setOpaque(false);
    roleLabel = new JLabel("Group: ", JLabel.RIGHT);
    roleBox = new JComboBox();
    JPanel btnsPanel = new JPanel(new GridLayout(1, 2));
    btnsPanel.setOpaque(false);
    JPanel btn1Panel = new JPanel();
    btn1Panel.setOpaque(false);
    JPanel btn2Panel = new JPanel();
    btn2Panel.setOpaque(false);
    quitButton = new JButton("Quit");
    loginButton = new JButton("Login");

    topPanel.add(emptyLabel);
    topPanel.add(loginLabel);
    namePanel.add(nameLabel);
    nameFieldPanel.add(nameField, BorderLayout.WEST);
    namePanel.add(nameFieldPanel);
    passwdPanel.add(passwdLabel);
    passwdFieldPanel.add(passwdField, BorderLayout.WEST);
    passwdPanel.add(passwdFieldPanel);
    rolePanel.add(roleLabel);
    roleBoxPanel.add(roleBox, BorderLayout.WEST);
    rolePanel.add(roleBoxPanel);
    btn1Panel.add(quitButton);
    btn2Panel.add(loginButton);
    btnsPanel.add(btn1Panel);
    btnsPanel.add(btn2Panel);

    final ImageIcon bg = new ImageIcon(this.getClass().getResource(File.separator + "11.jpg"));

    JPanel mainView =
        new JPanel(new GridLayout(7, 1)) {
          /** */
          private static final long serialVersionUID = 1L;

          @Override
          protected void paintComponent(Graphics g) {
            img = bg.getImage();
            super.paintComponent(g);
            g.drawImage(img, -200, 0, null);
          }
        };

    mainView.add(emptyLabel);
    mainView.add(loginLabel);
    mainView.add(promptLabel);
    mainView.add(namePanel);
    mainView.add(passwdPanel);
    mainView.add(rolePanel);
    mainView.add(btnsPanel);
    //		getContentPane().add(image);
    Container c = this.getContentPane();
    c.add(mainView);

    setSize(350, 280);
    setLocationRelativeTo(null);
    setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    MainController ctrl = new MainController();
    ctrl.handleLogin(this);
    ctrl.setLoginComboBox(roleBox, this);
  }
 public void setEchoChar(char c) {
   super.setEchoChar(c);
 }
예제 #6
0
  public RegisterPanel() {
    setBackground(SystemColor.window);
    setLayout(null);
    add(Regtitle);
    add(RegLogo1);
    add(UserIcon);
    add(lblBack);
    add(Register_username);
    add(Register_password);
    add(Tip);
    add(RegButton);
    Regtitle.setFont(new Font("Arial", Font.PLAIN, 40));
    Regtitle.setBounds(230, 75, 280, 50);
    RegLogo1.setBounds(140, 60, 80, 80);
    UserIcon.setBounds(130, 176, 100, 100); // need PS
    lblBack.setForeground(Color.BLUE);
    lblBack.setFont(new Font("Lucida Grande", Font.PLAIN, 16));
    lblBack.setBounds(470, 180, 80, 35);
    Register_username.setToolTipText("email address");
    Register_username.setBounds(240, 180, 220, 35);
    Register_username.setColumns(10);
    Register_password.setToolTipText("password");
    Register_password.setEchoChar((char) (0));
    Register_password.setBounds(240, 240, 220, 35);
    Tip.setBounds(245, 252, 160, 20);
    RegButton.setBounds(240, 300, 120, 40);

    lblBack.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent e) {
            MainFrame.cl.show(MainFrame.panelCont, "Log");
            Register_username.setText("email address");
            Register_password.setText("password");
            Register_password.setEchoChar((char) (0));
          }

          public void mouseExited(MouseEvent e) {
            lblBack.setForeground(Color.BLUE);
          }

          public void mouseEntered(MouseEvent e) {
            lblBack.setForeground(Color.MAGENTA);
          }

          public void mouseReleased(MouseEvent e) {}

          public void mousePressed(MouseEvent e) {}
        });

    class FocusHandler extends FocusAdapter {
      public void focusGained(FocusEvent e) {
        if (e.getSource() == Register_username) {
          if ("email address".equals(Register_username.getText())) Register_username.setText("");
        }
        if (e.getSource() == Register_password) {
          if ("password".equals(Register_password.getText())) Register_password.setText("");
          Register_password.setEchoChar('*');
        }
        if (("".equals(Register_password.getText()))
            | ("password".equals(Register_password.getText()))) {
        } else {
          Register_password.setEchoChar('*');
        }
      }

      public void focusLost(FocusEvent e) {
        if (e.getSource() == Register_username) {
          if ("".equals(Register_username.getText())) Register_username.setText("email address");
        }
        if (e.getSource() == Register_password) {
          if ("".equals(Register_password.getText())) Register_password.setText("password");
          Register_password.setEchoChar((char) (0));
        }
        if (("".equals(Register_password.getText()))
            | ("password".equals(Register_password.getText()))) {
        } else {
          Register_password.setEchoChar('*');
        }
      }
    }

    Register_username.addFocusListener(new FocusHandler());
    Register_password.addFocusListener(new FocusHandler());

    RegButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            validate = Email(Register_username.getText());
            if (validate == true) {
              LoginPanel.operation = "create-new-account?";
              LoginFunction.Test(
                  LoginPanel.operation, Register_username.getText(), Register_password.getText());
            } else {
              JOptionPane.showMessageDialog(null, "Not a valid email address");
            }
            Register_username.setText("email address");
            Register_password.setText("password");
            Register_password.setEchoChar((char) (0));
          }
        });
  }
예제 #7
0
  public User() {

    frame = new JFrame("WELCOME TO LIBRARY MANAGEMENT_system");
    frame.setLayout(new FlowLayout());

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    // setSize(100,100);
    frame.setLayout(new FlowLayout());

    JButton b1 = new JButton("Save arrayList");
    b1.addActionListener(new Action(this));

    JButton b2 = new JButton("Save File");
    b2.addActionListener(new FileSave(this));

    JButton b3 = new JButton("Administrative");
    b3.addActionListener(new Admin(this));

    JButton b10 = new JButton("CHECK");
    b10.addActionListener(new Match(this));

    JButton b4 = new JButton("controller");
    b4.addActionListener(new Admin(this));

    JButton b5 = new JButton("ADD_student");
    b5.addActionListener(new Addstd(this));

    JButton b15 = new JButton("SAVE STUDENT DATA");
    b15.addActionListener(new Savestud(this));

    /* JButton b6 = new JButton("REMOVE_student");
    b6.addActionListener(new FileSave(this));*/

    JButton b7 = new JButton("ADD_NEW_BOOK");
    b7.addActionListener(new Booksav(this));

    JButton b8 = new JButton("SEARCH_book");
    b8.addActionListener(new Matchbook(this));

    /*JButton b9 = new JButton("REMOVE_book");
    b9.addActionListener(new FileSave(this));*/

    JButton b11 = new JButton("REGARDING_student");
    b11.addActionListener(new Regstdu(this));

    JButton b12 = new JButton("REGARDING_book");
    b12.addActionListener(new Regsbook(this));

    JButton b13 = new JButton("LOg_in");
    b13.addActionListener(new Login(this));

    JButton b14 = new JButton("SEARCH_student");
    b14.addActionListener(new Matchstd(this));

    JLabel l1 = new JLabel("UID");
    t1 = new JTextField(20);

    JLabel l2 = new JLabel("PASS");
    t2 = new JPasswordField(20);
    t2.setEchoChar('*');

    JLabel l3 = new JLabel("student_name");
    t3 = new JTextField(20);

    JLabel l4 = new JLabel("student_ID");
    t4 = new JTextField(20);

    JLabel l5 = new JLabel("student_Address");
    t5 = new JTextField(100);

    JLabel l6 = new JLabel("Enter_Book_ISBN");
    t6 = new JTextField(20);

    JLabel l7 = new JLabel("BOOK_title");
    t7 = new JTextField(40);

    JLabel l8 = new JLabel("Author_name");
    t8 = new JTextField(35);

    p1 = new JPanel();
    p3 = new JPanel();
    p4 = new JPanel();
    p5 = new JPanel();
    p6 = new JPanel();
    p7 = new JPanel();
    p8 = new JPanel();
    p9 = new JPanel();
    p11 = new JPanel();
    p12 = new JPanel();
    p13 = new JPanel();
    p14 = new JPanel();
    p15 = new JPanel();

    p1.add(b3);
    p1.add(b4);
    frame.add(p1);

    p3.add(l1);
    p3.add(t1);
    p3.setVisible(false);
    frame.add(p3);

    p4.add(l2);
    p4.add(t2);
    p4.setVisible(false);
    frame.add(p4);

    p5.add(b1);
    p5.add(b2);
    p5.add(b10);

    p5.setVisible(false);
    frame.add(p5);

    p6.add(b11);
    p6.add(b12);
    p6.setVisible(false);
    frame.add(p6);

    p7.add(l3);
    p7.add(t3);
    p7.setVisible(false);
    frame.add(p7);

    p8.add(l4);
    p8.add(t4);
    p8.setVisible(false);
    frame.add(p8);

    p9.add(l5);
    p9.add(t5);
    p9.setVisible(false);
    frame.add(p9);

    p11.add(l6);
    p11.add(t6);
    p11.setVisible(false);
    frame.add(p11);

    p12.add(l8);
    p12.add(t8);
    p12.setVisible(false);
    frame.add(p12);

    p13.add(b13);
    p13.setVisible(false);
    frame.add(p13);

    p14.add(b5);
    p14.add(b15);
    p14.add(b14);
    p14.setVisible(false);
    frame.add(p14);

    p15.add(b7);
    p15.add(b8);
    // p15.add(b9);
    p15.setVisible(false);
    frame.add(p15);

    // Pack();
    frame.setSize(300, 200);
    frame.setVisible(true);

    f = new File(fileLocation);
    frame.setSize(300, 200);
    frame.setVisible(true);
  }
  /** Create the frame. */
  public LoginWindow() {
    setAutoRequestFocus(false);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 454, 488);
    contentPane = new JPanel();
    contentPane.setForeground(UIManager.getColor("ScrollBar.trackHighlightForeground"));
    contentPane.setBackground(UIManager.getColor("ScrollBar.track"));
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);

    JTextPane WelcomeMessage = new JTextPane();
    WelcomeMessage.setEditable(false);
    WelcomeMessage.setBackground(UIManager.getColor("Separator.highlight"));
    WelcomeMessage.setForeground(Color.DARK_GRAY);
    WelcomeMessage.setFont(new Font("Verdana", Font.BOLD, 11));
    WelcomeMessage.setText("\tWelcome to Neighborhood Information Center");

    JPanel panel = new JPanel();
    panel.setForeground(UIManager.getColor("TextPane.caretForeground"));
    panel.setBorder(new LineBorder(UIManager.getColor("TextField.background")));
    panel.setBackground(UIManager.getColor("TextField.disabledBackground"));

    JTextPane LoginMessage = new JTextPane();
    LoginMessage.setEditable(false);
    LoginMessage.setText("Please Login to Continue");
    LoginMessage.setForeground(SystemColor.controlText);
    LoginMessage.setFont(new Font("Verdana", Font.BOLD, 11));
    LoginMessage.setBackground(UIManager.getColor("TextField.disabledBackground"));

    LoginField = new JTextField();
    LoginField.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Login = LoginField.getText();
            System.out.println("\n Login-ID is : " + Login);
          }
        });
    LoginField.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            LoginField.setText("");
            LoginField.setForeground(Color.BLACK);
          }
        });
    LoginField.setBackground(UIManager.getColor("TextField.background"));
    LoginField.setForeground(SystemColor.scrollbar);
    LoginField.setText("Login ID");
    LoginField.setColumns(10);

    JButton LoginButton = new JButton("Login");
    LoginButton.addActionListener(
        new ActionListener() {
          @SuppressWarnings({})
          public void actionPerformed(ActionEvent arg0) {

            Login = LoginField.getText();
            System.out.println("\n Login-ID is : " + Login);

            Password = passwordField.getText();
            System.out.println("\n LOGIN BUTTON - Password is : " + Password);

            // ******************************************************************************
            // Set LoginField Back to Normal
            LoginField.setText("");
            LoginField.setBackground(UIManager.getColor("TextField.background"));
            LoginField.setForeground(SystemColor.scrollbar);
            LoginField.setText("Login ID");

            // Set PasswordField Back to Normal
            passwordField.setText("");
            passwordField.setBackground(UIManager.getColor("TextField.background"));
            passwordField.setForeground(SystemColor.scrollbar);
            char c = 0;
            passwordField.setEchoChar(c);
            passwordField.setText("Password");
            // *******************************************************************************

            int Valid = -99;

            try {
              int info = 1;
              Valid = database.getInfo(connection, Login, Password, info);
            } catch (SQLException e) {
              // TODO Auto-generated catch block
              System.out.printf("\n Failed to retrieve \n");
            }

            if (Valid > 0) {
              System.out.printf(" Successful in Login App. \n");
              frame.setVisible(false);
              userGUI program = new userGUI();
              // System.exit(0);
            } else {
              UnsuccessfulLogin fail = new UnsuccessfulLogin(Login);
              fail.NoSuccess(Login);
            }
          }
        });
    LoginButton.setBackground(new Color(102, 153, 255));

    JTextPane txtpnCreateAnAccount = new JTextPane();
    txtpnCreateAnAccount.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            CreateAccount newAcct = new CreateAccount();
            newAcct.account();
          }
        });
    txtpnCreateAnAccount.setEditable(false);
    txtpnCreateAnAccount.setText("Create an account");
    txtpnCreateAnAccount.setForeground(new Color(25, 25, 112));
    txtpnCreateAnAccount.setFont(new Font("Verdana", Font.BOLD, 11));
    txtpnCreateAnAccount.setBackground(SystemColor.menu);

    passwordField = new JPasswordField();

    // Setting Password as text
    passwordField.setBackground(UIManager.getColor("TextField.background"));
    passwordField.setForeground(SystemColor.scrollbar);
    passwordField.setText("Password");
    char c = 0;
    passwordField.setEchoChar(c);
    passwordField.setText("Password");

    // Done setting text

    passwordField.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            char c = 183;
            passwordField.setForeground(Color.black);
            passwordField.setEchoChar(c);
            passwordField.setText("");
          }
        });
    passwordField.setBackground(UIManager.getColor("TextField.background"));
    passwordField.setForeground(SystemColor.scrollbar);
    passwordField.setText("Password");
    passwordField.addActionListener(
        new ActionListener() {
          @SuppressWarnings("deprecation")
          public void actionPerformed(ActionEvent e) {

            Password = passwordField.getText();

            System.out.println("\n Password is : " + Password);
          }
        });
    GroupLayout gl_panel = new GroupLayout(panel);
    gl_panel.setHorizontalGroup(
        gl_panel
            .createParallelGroup(Alignment.TRAILING)
            .addGroup(
                gl_panel
                    .createSequentialGroup()
                    .addContainerGap(60, Short.MAX_VALUE)
                    .addGroup(
                        gl_panel
                            .createParallelGroup(Alignment.TRAILING)
                            .addGroup(
                                gl_panel
                                    .createSequentialGroup()
                                    .addComponent(
                                        txtpnCreateAnAccount,
                                        GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addGap(63))
                            .addGroup(
                                gl_panel
                                    .createSequentialGroup()
                                    .addGroup(
                                        gl_panel
                                            .createParallelGroup(Alignment.TRAILING, false)
                                            .addComponent(
                                                LoginMessage,
                                                Alignment.LEADING,
                                                GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                LoginButton,
                                                Alignment.LEADING,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .addComponent(
                                                LoginField,
                                                Alignment.LEADING,
                                                GroupLayout.DEFAULT_SIZE,
                                                166,
                                                Short.MAX_VALUE)
                                            .addComponent(passwordField))
                                    .addGap(42)))));
    gl_panel.setVerticalGroup(
        gl_panel
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_panel
                    .createSequentialGroup()
                    .addGap(30)
                    .addComponent(
                        LoginMessage,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)
                    .addGap(56)
                    .addComponent(
                        LoginField,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)
                    .addGap(18)
                    .addComponent(
                        passwordField,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)
                    .addGap(18)
                    .addComponent(LoginButton)
                    .addPreferredGap(ComponentPlacement.RELATED, 66, Short.MAX_VALUE)
                    .addComponent(
                        txtpnCreateAnAccount,
                        GroupLayout.PREFERRED_SIZE,
                        21,
                        GroupLayout.PREFERRED_SIZE)
                    .addGap(47)));
    panel.setLayout(gl_panel);
    GroupLayout gl_contentPane = new GroupLayout(contentPane);
    gl_contentPane.setHorizontalGroup(
        gl_contentPane
            .createParallelGroup(Alignment.TRAILING)
            .addGroup(
                gl_contentPane
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        gl_contentPane
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(
                                gl_contentPane
                                    .createSequentialGroup()
                                    .addComponent(
                                        WelcomeMessage,
                                        GroupLayout.DEFAULT_SIZE,
                                        418,
                                        Short.MAX_VALUE)
                                    .addGap(0))
                            .addGroup(
                                Alignment.TRAILING,
                                gl_contentPane
                                    .createSequentialGroup()
                                    .addComponent(
                                        panel,
                                        GroupLayout.PREFERRED_SIZE,
                                        270,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addGap(66)))));
    gl_contentPane.setVerticalGroup(
        gl_contentPane
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_contentPane
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        WelcomeMessage,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)
                    .addGap(18)
                    .addComponent(
                        panel, GroupLayout.PREFERRED_SIZE, 342, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(48, Short.MAX_VALUE)));
    contentPane.setLayout(gl_contentPane);
  }
예제 #9
0
  protected void createPanel() throws RaplaException {

    externalConfigEnabled = configService.isExternalConfigEnabled();
    mailServer = textFieldFactory.create();
    smtpPortField = new RaplaNumber(new Integer(25), new Integer(0), null, false);
    defaultSender = new JTextField();
    username = new JTextField();
    password = new JPasswordField();
    send = new RaplaButton();
    password.setEchoChar('*');

    content = new JPanel();
    // addCopyPaste( mailServer);
    addCopyPaste(defaultSender, getI18n(), getRaplaLocale(), ioInterface, getLogger());
    addCopyPaste(username, getI18n(), getRaplaLocale(), ioInterface, getLogger());
    addCopyPaste(password, getI18n(), getRaplaLocale(), ioInterface, getLogger());
    double[][] sizes =
        new double[][] {
          {5, TableLayout.PREFERRED, 5, TableLayout.FILL, 5},
          {
            TableLayout.PREFERRED,
            5,
            TableLayout.PREFERRED,
            5,
            TableLayout.PREFERRED,
            5,
            TableLayout.PREFERRED,
            5,
            TableLayout.PREFERRED,
            5,
            TableLayout.PREFERRED,
            5,
            TableLayout.PREFERRED,
            5,
            TableLayout.PREFERRED
          }
        };
    TableLayout tableLayout = new TableLayout(sizes);
    content.setLayout(tableLayout);
    if (externalConfigEnabled) {
      JLabel info = new JLabel("Mail config is provided by servlet container.");
      content.add(info, "3,0");
    } else {
      content.add(new JLabel("Mail Server"), "1,0");
      content.add(mailServer.getComponent(), "3,0");
      content.add(new JLabel("Use SSL*"), "1,2");
      content.add(useSsl, "3,2");
      content.add(new JLabel("Mail Port"), "1,4");
      content.add(smtpPortField, "3,4");
      content.add(new JLabel("Username"), "1,6");
      content.add(username, "3,6");
      content.add(new JLabel("Password"), "1,8");
      JPanel passwordPanel = new JPanel();
      passwordPanel.setLayout(new BorderLayout());
      content.add(passwordPanel, "3,8");
      passwordPanel.add(password, BorderLayout.CENTER);
      final JCheckBox showPassword = new JCheckBox("show password");
      passwordPanel.add(showPassword, BorderLayout.EAST);
      showPassword.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              boolean show = showPassword.isSelected();
              password.setEchoChar(show ? ((char) 0) : '*');
            }
          });
      content.add(new JLabel("Default Sender"), "1,10");
      content.add(defaultSender, "3,10");
    }

    content.add(new JLabel("Test Mail"), "1,12");
    content.add(send, "3,12");
    String mailid = getUser().getEmail();
    if (mailid.length() == 0) {
      send.setText("Send to " + getUser() + " : Provide email in user profile");
      send.setEnabled(false);
      // java.awt.Font font = send.getFont();
      // send.setFont( font.deriveFont( Font.BOLD));

    } else {
      send.setText("Send to " + getUser() + " : " + mailid);
      send.setEnabled(true);
      // send.setBackground(Color.GREEN);
    }
    useSsl.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            if (listenersEnabled) {
              int port = useSsl.isSelected() ? 465 : 25;
              smtpPortField.setNumber(new Integer(port));
            }
          }
        });
    send.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            try {
              DefaultConfiguration newConfig = new DefaultConfiguration(config);
              Configuration[] children = newConfig.getChildren();
              for (Configuration child : children) {
                newConfig.removeChild(child);
              }
              //					if ( !activate.isSelected())
              //					{
              //						throw new RaplaException("You need to activate MailPlugin " +
              // getString("restart_options"));
              //					}
              if (!externalConfigEnabled) {
                addChildren(newConfig);
                //						if ( !newConfig.equals( config))
                //						{
                //							getLogger().info("old config" + config );
                //							getLogger().info("new config" + newConfig);
                //							throw new RaplaException(getString("restart_options"));
                //						}
              } else {
                String attribute = config.getAttribute("enabled", null);
                if (attribute == null || !attribute.equalsIgnoreCase("true")) {
                  throw new RaplaException(getString("restart_options"));
                }
              }
              // String senderMail = defaultSender.getText();
              String recipient = getUser().getEmail();
              if (recipient == null || recipient.trim().length() == 0) {
                throw new RaplaException("You need to set an email address in your user settings.");
              }

              try {
                send.setBackground(new Color(255, 100, 100, 255));
                configService.testMail(newConfig, defaultSender.getText());
                send.setBackground(Color.GREEN);
                send.setText("Please check your mailbox.");
              } catch (UnsupportedOperationException ex) {
                JComponent component = getComponent();
                dialogUiFactory.showException(
                    new RaplaException(getString("restart_options")),
                    new SwingPopupContext(component, null));
              }
            } catch (RaplaException ex) {
              JComponent component = getComponent();
              dialogUiFactory.showException(ex, new SwingPopupContext(component, null));

              //				} catch (ConfigurationException ex) {
              //					JComponent component = getComponent();
              //					showException( ex, component);
            }
          }
        });
  }