public void actionPerformed(ActionEvent e) {
   if (e.getActionCommand().equals(CANCEL)) this.dispose();
   if (e.getActionCommand().equals(OK)) {
     // Check password
     try {
       UserAccountDao uad2 = new UserAccountDaoImpl();
       user = uad2.loginAuthorization(this.getUsername(), this.getPassword());
       System.out.println("the user's email:" + user.getEmail() + "admin?:" + getIsAdmin());
       model.setMyAccount(user);
       successfulLogin();
       this.dispose();
     } catch (PwdIncorrectException pie) {
       // pop up a window said incorrect password
       JOptionPane.showMessageDialog(
           null, "Incorrect password. Try again.", "Error Message", JOptionPane.ERROR_MESSAGE);
       passwordField.selectAll();
       passwordField.setText("");
       userName.setText("");
     } catch (UserAccountNotFoundException uanfe) {
       // pop up a window said cannot find the user account
       JOptionPane.showMessageDialog(
           null, "User not exist. Try again.", "Error Message", JOptionPane.ERROR_MESSAGE);
       passwordField.selectAll();
       passwordField.setText("");
       userName.setText("");
     }
   }
 }
 private void loadConfig() {
   // check for file
   this.fileCheck = new File("cHamster.config");
   this.configFile = new Properties();
   // check for existing config
   if (fileCheck.exists()) {
     try {
       this.configFile.load(new FileReader(fileCheck));
     } catch (FileNotFoundException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     } catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
     // Load configuration
     userField.setText(this.configFile.getProperty("username"));
     passwordField.setText(this.configFile.getProperty("password"));
     serverField.setText(this.configFile.getProperty("server"));
     portField.setText(this.configFile.getProperty("port"));
     resField.setText(this.configFile.getProperty("resolution"));
     fpsField.setText(this.configFile.getProperty("fps"));
   } else {
     // Create new default configuration and store it
     userField.setText("big");
     passwordField.setText("brother");
     serverField.setText("www.example.com");
     portField.setText("6666");
     resField.setText("320x240");
     fpsField.setText("5");
     this.storeConfig();
     // (Default values allready in the fields)
   }
 }
예제 #3
0
 private void checkLogin() {
   // 对输入进行基本的合法非法判断
   String id = idTxt.getText();
   String passwd = String.valueOf(passwordTxt.getPassword());
   ResultMessage idResult = Utility.checkInputValid(id, 4, 14, false);
   ResultMessage passwdResult = Utility.checkInputValid(passwd, 5, 14, false);
   if (idResult != ResultMessage.SUCCESS) {
     MyOptionPane.showMessageDialog(null, "输入的用户名" + idResult.toFriendlyString() + "!");
     return;
   } else if (passwdResult != ResultMessage.SUCCESS) {
     MyOptionPane.showMessageDialog(null, "输入的密码" + passwdResult.toFriendlyString() + "!");
     return;
   }
   // 登录验证
   ResultMessage loginresult = loginController.login(usertype.getSelectedIndex(), id, passwd);
   if (loginresult == ResultMessage.SUCCESS) {
     new HomeUI(loginController);
     frame.dispose();
   } else {
     if (loginresult == ResultMessage.WRONG_ID) {
       MyOptionPane.showMessageDialog(null, "用户名错误!");
       idTxt.setText("");
       passwordTxt.setText("");
     } else if (loginresult == ResultMessage.WRONG_PASSWD) {
       MyOptionPane.showMessageDialog(null, "密码错误!");
       passwordTxt.setText("");
     } else {
       MyOptionPane.showMessageDialog(null, "服务器未开启!");
     }
   }
 }
 // efface le texte
 public void deleteEntry() {
   name.setText("");
   firstName.setText("");
   address.setText("");
   password.setText("");
   password2.setText("");
   login.setText("");
 }
  /** Clears all the data previously entered in the form. */
  public void clear() {
    usernameField.setText("");
    displayNameField.setText("");
    passField.setText("");
    retypePassField.setText("");
    emailField.setText("");
    errorPane.setText("");

    remove(errorPane);
  }
  /** Limpa os campos da janela */
  @Override
  public void limparCampos() {
    inserirBordasPadrao();

    loginTextField.setText("");
    passwordField.setText("");
    rPasswordField.setText("");

    rdbtnAdministrador.setSelected(true);
  }
예제 #7
0
  public boolean validarCampos() {

    boolean resp = true;
    int clv;

    usuario = txtusuario.getText();
    clave = new String(txtclave.getPassword());

    // si usuario esta vacio
    if (usuario.trim().length() == 0) {
      JOptionPane.showMessageDialog(
          this,
          "Por favor Ingrese el Usuario",
          "Campo Usuario (Obligatorio)",
          JOptionPane.ERROR_MESSAGE);
      resp = txtusuario.requestFocusInWindow();
      return resp;
    }
    // si clave esta vacio
    if (clave.trim().length() == 0) {
      JOptionPane.showMessageDialog(
          this,
          "Por favor ingrese la clave",
          "Campo Contraseña (Obligatorio)",
          JOptionPane.ERROR_MESSAGE);
      resp = false;
      return resp;
    }
    if (usuario.trim().length() < 3 || usuario.trim().length() > 20) {
      JOptionPane.showMessageDialog(
          this,
          "Debe ingresar mínimo 3 caracteres " + "y máximo 20",
          "Campo Usuario (Obligatorio)",
          JOptionPane.ERROR_MESSAGE);
      txtusuario.setText("");
      txtclave.setText("");
      txtusuario.requestFocusInWindow();
      resp = false;
      return resp;
    }

    if (clave.trim().length() < 3 || clave.trim().length() > 16) {
      JOptionPane.showMessageDialog(
          this,
          "Debe ingresar mínimo 3 caracteres " + "y máximo 16",
          "Campo Clave (Obligatorio)",
          JOptionPane.ERROR_MESSAGE);
      txtclave.setText("");
      txtclave.requestFocusInWindow();
      resp = false;
      return resp;
    }

    return resp;
  }
 /** resets all textfields to empty string "" */
 public void clean() {
   update.setText("");
   username.setText("");
   userWrong.setText("");
   emailf.setText("");
   password2.setText("");
   pass2Wrong.setText("");
   password1.setText("");
   pass1Wrong.setText("");
   emailWrong.setText("");
 }
예제 #9
0
  /** Modifies the existing password. */
  private void changePassword() {
    UserNotifier un;
    if (!oldPassword.isVisible()) {
      StringBuffer buf = new StringBuffer();
      buf.append(passwordNew.getPassword());
      String newPass = buf.toString();
      if (newPass == null || newPass.length() == 0) {
        un = MetadataViewerAgent.getRegistry().getUserNotifier();
        un.notifyInfo(PASSWORD_CHANGE_TITLE, "Please enter the new password.");
        passwordNew.requestFocus();
        return;
      }
      un = MetadataViewerAgent.getRegistry().getUserNotifier();
      un.notifyInfo(PASSWORD_CHANGE_TITLE, "Password changed.");
      passwordNew.setText("");
      model.resetPassword(newPass);
      return;
    }
    StringBuffer buf = new StringBuffer();
    buf.append(passwordNew.getPassword());
    String newPass = buf.toString();

    String pass = buf.toString();
    buf = new StringBuffer();
    buf.append(passwordConfirm.getPassword());
    String confirm = buf.toString();

    buf = new StringBuffer();
    buf.append(oldPassword.getPassword());
    String old = buf.toString();
    if (old == null || old.trim().length() == 0) {
      un = MetadataViewerAgent.getRegistry().getUserNotifier();
      un.notifyInfo(PASSWORD_CHANGE_TITLE, "Please specify your old password.");
      oldPassword.requestFocus();
      return;
    }
    if (newPass == null || newPass.length() == 0) {
      un = MetadataViewerAgent.getRegistry().getUserNotifier();
      un.notifyInfo(PASSWORD_CHANGE_TITLE, "Please enter your new password.");
      passwordNew.requestFocus();
      return;
    }

    if (pass == null || confirm == null || confirm.length() == 0 || !pass.equals(confirm)) {
      un = MetadataViewerAgent.getRegistry().getUserNotifier();
      un.notifyInfo(
          PASSWORD_CHANGE_TITLE, "The passwords entered do not match. " + "Please try again.");
      passwordNew.setText("");
      passwordConfirm.setText("");
      passwordNew.requestFocus();
      return;
    }
    model.changePassword(old, confirm);
  }
  /**
   * Initializes all of the text fields to empty string ""
   *
   * @throws SQLException throws exception if connection could not be made
   */
  void init() throws SQLException {
    if (u != null) {
      userWrong.setText("");
      pass1Wrong.setText("");
      pass2Wrong.setText("");
      emailWrong.setText("");

      emailf.setText("");
      password1.setText("");
      password2.setText("");
    }
  }
예제 #11
0
 public void effacer_edit() {
   nom.setText("Nom");
   prenom.setText("Prenom");
   date_naissance.setText("Date_naissance");
   email.setText("Email");
   password1.setText("Password");
   password2.setText("Password");
   adresse.setText("Adresse");
   ville.setText("Ville");
   code_postal.setText("Code postal");
   telephone.setText("Telephone");
   mobile.setText("Mobile");
 }
예제 #12
0
 public void effacer_login() {
   nomI.setText("New nom");
   prenomI.setText("New prenom");
   date_naissanceI.setText("New date de naissance");
   emailI.setText("New email");
   passwordI1.setText("New password");
   passwordI2.setText("New password");
   adresseI.setText("New adresse");
   villeI.setText("New ville");
   code_postalI.setText("New code postal");
   telephoneI.setText("New telephone");
   mobileI.setText("New mobile");
 }
예제 #13
0
  @SuppressWarnings("empty-statement")
  private String getPassWd(boolean first) {
    String passWd = "";
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    if (first) panel.add(new JLabel("Enter Password\n\n"));
    else panel.add(new JLabel("Re-enter Password\n\n"));
    final JPasswordField passwordField =
        new JPasswordField(10); // box to take passwords from the user
    panel.add(passwordField);
    JOptionPane pane =
        new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION) {
          private static final long serialVersionUID = 1L;

          @Override
          public void selectInitialValue() {
            passwordField.requestFocusInWindow();
          }
        };
    pane.createDialog(null, "Enter Password").setVisible(true);
    passWd =
        passwordField.getPassword().length == 0 ? null : new String(passwordField.getPassword());
    passwordField.setText("");
    return passWd;
  }
예제 #14
0
  public void actionPerformed(ActionEvent ae) {
    if (ae.getSource() == b1) {
      try {
        Class.forName("oracle.jdbc.driver.OracleDriver");
        Connection con =
            DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "system", "123");
        PreparedStatement ps =
            con.prepareStatement("select * from LoginForm where username=? and password=?");
        String UserName = t1.getText();
        String Password = jp1.getText();
        ps.setString(1, UserName);
        ps.setString(2, Password);
        ResultSet rs = ps.executeQuery();
        boolean flag = rs.next();
        if (flag) {
          new Main();
          f.setVisible(false);
        } else {
          JOptionPane.showMessageDialog(null, "Please Enter valid Name And Password");
        }

      } catch (Exception e) {
        System.out.println("Error:" + e);
      }
    } else if (ae.getSource() == b2) {
      t1.setText("");
      jp1.setText("");
    } else if (ae.getSource() == b3) {

      f.setVisible(false);
    }
  }
  public void reset() {
    myNoProxyRb.setSelected(true); // default
    HttpConfigurable httpConfigurable = myHttpConfigurable;
    myAutoDetectProxyRb.setSelected(httpConfigurable.USE_PROXY_PAC);
    myPacUrlCheckBox.setSelected(httpConfigurable.USE_PAC_URL);
    myPacUrlTextField.setText(httpConfigurable.PAC_URL);
    myUseHTTPProxyRb.setSelected(httpConfigurable.USE_HTTP_PROXY);
    myProxyAuthCheckBox.setSelected(httpConfigurable.PROXY_AUTHENTICATION);

    enableProxy(httpConfigurable.USE_HTTP_PROXY);

    myProxyLoginTextField.setText(httpConfigurable.PROXY_LOGIN);
    myProxyPasswordTextField.setText(httpConfigurable.getPlainProxyPassword());

    myProxyPortTextField.setText(Integer.toString(httpConfigurable.PROXY_PORT));
    myProxyHostTextField.setText(httpConfigurable.PROXY_HOST);
    myProxyExceptions.setText(httpConfigurable.PROXY_EXCEPTIONS);

    myRememberProxyPasswordCheckBox.setSelected(httpConfigurable.KEEP_PROXY_PASSWORD);
    mySocks.setSelected(httpConfigurable.PROXY_TYPE_IS_SOCKS);
    myHTTP.setSelected(!httpConfigurable.PROXY_TYPE_IS_SOCKS);

    final boolean showError = !StringUtil.isEmptyOrSpaces(httpConfigurable.LAST_ERROR);
    myErrorLabel.setVisible(showError);
    myErrorLabel.setText(showError ? errorText(httpConfigurable.LAST_ERROR) : "");

    final String oldStyleText =
        CommonProxy.getMessageFromProps(CommonProxy.getOldStyleProperties());
    myOtherWarning.setVisible(oldStyleText != null);
    if (oldStyleText != null) {
      myOtherWarning.setText(oldStyleText);
      myOtherWarning.setUI(new MultiLineLabelUI());
      myOtherWarning.setIcon(Messages.getWarningIcon());
    }
  }
예제 #16
0
  private boolean prepareX509Infrastructure() {
    if (caKeystorePassword == null) {
      JPasswordField pass = new JPasswordField(10);
      pass.setText(caKeystorePassword);
      pass.addAncestorListener(new RequestFocusListener());
      JPanel panel = new JPanel(new BorderLayout());
      panel.add(new JLabel(Translation.get("gb.enterKeystorePassword")), BorderLayout.NORTH);
      panel.add(pass, BorderLayout.CENTER);
      int result =
          JOptionPane.showConfirmDialog(
              GitblitAuthority.this,
              panel,
              Translation.get("gb.password"),
              JOptionPane.OK_CANCEL_OPTION);
      if (result == JOptionPane.OK_OPTION) {
        caKeystorePassword = new String(pass.getPassword());
      } else {
        return false;
      }
    }

    X509Metadata metadata = new X509Metadata("localhost", caKeystorePassword);
    setMetadataDefaults(metadata);
    metadata.notAfter = new Date(System.currentTimeMillis() + 10 * TimeUtils.ONEYEAR);
    X509Utils.prepareX509Infrastructure(metadata, folder, this);
    return true;
  }
  @Override
  public void reset(@NotNull HttpConfigurable settings) {
    myNoProxyRb.setSelected(true); // default
    myAutoDetectProxyRb.setSelected(settings.USE_PROXY_PAC);
    myPacUrlCheckBox.setSelected(settings.USE_PAC_URL);
    myPacUrlTextField.setText(settings.PAC_URL);
    myUseHTTPProxyRb.setSelected(settings.USE_HTTP_PROXY);
    myProxyAuthCheckBox.setSelected(settings.PROXY_AUTHENTICATION);

    enableProxy(settings.USE_HTTP_PROXY);

    myProxyLoginTextField.setText(settings.getProxyLogin());
    myProxyPasswordTextField.setText(settings.getPlainProxyPassword());

    myProxyPortTextField.setNumber(settings.PROXY_PORT);
    myProxyHostTextField.setText(settings.PROXY_HOST);
    myProxyExceptions.setText(StringUtil.notNullize(settings.PROXY_EXCEPTIONS));

    myRememberProxyPasswordCheckBox.setSelected(settings.KEEP_PROXY_PASSWORD);
    mySocks.setSelected(settings.PROXY_TYPE_IS_SOCKS);
    myHTTP.setSelected(!settings.PROXY_TYPE_IS_SOCKS);

    boolean showError = !StringUtil.isEmptyOrSpaces(settings.LAST_ERROR);
    myErrorLabel.setVisible(showError);
    myErrorLabel.setText(showError ? errorText(settings.LAST_ERROR) : null);

    final String oldStyleText =
        CommonProxy.getMessageFromProps(CommonProxy.getOldStyleProperties());
    myOtherWarning.setVisible(oldStyleText != null);
    if (oldStyleText != null) {
      myOtherWarning.setText(oldStyleText);
      myOtherWarning.setIcon(Messages.getWarningIcon());
    }
  }
예제 #18
0
 /** Overrides JDialog.setVisible to overwrite password fields before exiting. */
 public void setVisible(boolean flag) {
   if (!flag) {
     // Attempt to overwrite passwords in JPasswordFields
     // TBD: ?? Not sure if this does it or not
     char[] pchars = password.getPassword();
     if (pchars.length > 0) {
       Arrays.fill(pchars, '#');
       password.setText(new String(pchars));
     }
     char[] cchars = confirmPassword.getPassword();
     if (cchars.length > 0) {
       Arrays.fill(cchars, '#');
       confirmPassword.setText(new String(cchars));
     }
   }
   super.setVisible(flag);
 }
예제 #19
0
파일: PanelRepo.java 프로젝트: vrodmz/ADI
  @Override
  public void cargarDatos() {
    ConfiguracionUsuario config = ConfiguracionUsuario.getInstance();

    directorioRepo.setText(config.getProperty(EnumConfiguracionUsuario.REPOSITORIO));
    usuarioRepo.setText(config.getProperty(EnumConfiguracionUsuario.USUARIO_REPO));
    contrasenaRepo.setText(config.getProperty(EnumConfiguracionUsuario.CONTRASENA_REPO));
  }
예제 #20
0
 /*
  * 清空文本框中内容并重新生成验证码
  */
 public void Tip() {
   user.setText("");
   passWd.setText("");
   checktflogin.setText("");
   randomno.setText("");
   randomno.setIcon(new ImageIcon(randomphoto.update()));
   flogin.setVisible(true);
 }
예제 #21
0
        @SuppressWarnings({"static-access", "deprecation"})
        public void actionPerformed(ActionEvent e) {
          if (txtFolio.getText().equals("")) {
            txtFolio.setText("");
            txtNombre.setText("");
            pxpClave.setText("");
            JOptionPane.showMessageDialog(
                null,
                "Ingrese un folio para realizar la función",
                "Aviso",
                JOptionPane.WARNING_MESSAGE);
            return;
          } else {
            Obj_Usuario usuario = new Obj_Usuario().buscar(Integer.parseInt(txtFolio.getText()));
            if (usuario.getFolio() != 0) {
              if (pxpClave.getText().equals("")) {
                JOptionPane.showMessageDialog(
                    null, "Inserte la contraseña.", "Aviso", JOptionPane.WARNING_MESSAGE);
                return;
              } else {
                Obj_MD5 algoritmo = new Obj_MD5();
                String cadena = algoritmo.cryptMD5(pxpClave.getText(), "izagar");
                String clave = usuario.getContrasena();

                System.out.println("pxp=" + cadena + "  bd=" + clave);
                System.out.println(cadena.length() + " " + clave.length());
                if (!clave.equals(cadena)) {
                  txtFolio.setText("");
                  txtNombre.setText("");
                  pxpClave.setText("");
                  JOptionPane.showMessageDialog(
                      null, "La contraseñas no es valida", "Aviso", JOptionPane.WARNING_MESSAGE);
                  return;
                } else {
                  dispose();
                  new Principal().setVisible(true);
                }
              }

            } else {
              JOptionPane.showMessageDialog(
                  null, "El Usuario no existe", "Aviso", JOptionPane.WARNING_MESSAGE);
              return;
            }
          }
        }
예제 #22
0
 private void setEditorText(final String text) {
   modifier.incrementAndGet();
   try {
     editor.setText(text);
   } finally {
     modifier.decrementAndGet();
   }
 }
예제 #23
0
 private void resetFields() {
   this.isPortTextFieldDirty = false;
   hostnameTextField.setText("");
   protocolList.setSelectedItem(Protocol.FTP);
   usernameTextField.setText("");
   passwordTextField.setText("");
   defaultRemotePathTextField.setText("");
 }
예제 #24
0
  /**
   * Load the user's data.
   *
   * @param queryResult - ResultSet returned by ClientTask in loadUsersDataEntry
   */
  private void getUserByIdDataEntry(ResultSet queryResult) {
    try {
      if (queryResult.next()) {
        // updating a user
        userName.setText(queryResult.getString(2));
        fname.setText(queryResult.getString(4));
        lname.setText(queryResult.getString(3));
        unitizeCheckBox.setSelected((queryResult.getString(5).equals("Yes") ? true : false));
        uqcCheckBox.setSelected((queryResult.getString(6).equals("Yes") ? true : false));
        codingCheckBox.setSelected((queryResult.getString(7).equals("Yes") ? true : false));
        codingqcCheckBox.setSelected((queryResult.getString(8).equals("Yes") ? true : false));
        listingCheckBox.setSelected(
            ((queryResult.getString(9) == null || queryResult.getString(9).equals("Yes"))
                ? true
                : false));
        tallyCheckBox.setSelected(
            ((queryResult.getString(10) == null || queryResult.getString(10).equals("Yes"))
                ? true
                : false));
        qaCheckBox.setSelected((queryResult.getString(11).equals("Yes") ? true : false));
        tlCheckBox.setSelected((queryResult.getString(12).equals("Yes") ? true : false));
        adminCheckBox.setSelected((queryResult.getString(13).equals("Yes") ? true : false));
        adminUsersCheckBox.setSelected((queryResult.getString(14).equals("Yes") ? true : false));
        adminProjectCheckBox.setSelected((queryResult.getString(15).equals("Yes") ? true : false));
        adminBatchCheckBox.setSelected((queryResult.getString(16).equals("Yes") ? true : false));
        adminEditCheckBox.setSelected((queryResult.getString(17).equals("Yes") ? true : false));
        adminImportCheckBox.setSelected((queryResult.getString(18).equals("Yes") ? true : false));
        adminExportCheckBox.setSelected((queryResult.getString(19).equals("Yes") ? true : false));
        adminProfitCheckBox.setSelected((queryResult.getString(20).equals("Yes") ? true : false));
        teamsCombo.setSelectedIndex(teamsModel.indexOf(queryResult.getInt(1)));
        password.setText("");
        confirmPassword.setText("");
        String date = queryResult.getString(21);

        if (null != date) {
          String[] splitDate = date.split(" ");
          field.setText(splitDate[0]);
        }

        enableAdminPriv();
      }
    } catch (SQLException e) {
      Log.quit(e);
    }
  }
예제 #25
0
 public void setVisible(boolean bShow, String title) {
   if (bShow) {
     String strDir = "";
     String strFreq = "";
     String strTraynum = "";
     m_strHelpFile = getHelpFile(title);
     String strSampleName = getSampleName(title);
     String frameBounds = getFrameBounds(title);
     StringTokenizer tok = new QuotedStringTokenizer(title);
     if (tok.hasMoreTokens()) strDir = tok.nextToken();
     if (tok.hasMoreTokens()) strFreq = tok.nextToken();
     if (tok.hasMoreTokens()) strTraynum = tok.nextToken();
     else {
       try {
         Integer.parseInt(strDir);
         // if strdir is number, then strdir is empty, and the
         // strfreq is the number
         strTraynum = strFreq;
         strFreq = strDir;
         strDir = "";
       } catch (Exception e) {
       }
     }
     try {
       setTitle(gettitle(strFreq));
       m_lblSampleName.setText("3");
       boolean bVast = isVast(strTraynum);
       CardLayout layout = (CardLayout) m_pnlSampleName.getLayout();
       if (!bVast) {
         if (strSampleName == null) {
           strSampleName = getSampleName(strDir, strTraynum);
         }
         m_lblSampleName.setText(strSampleName);
         layout.show(m_pnlSampleName, OTHER);
       } else {
         m_strDir = strDir;
         setTrays();
         layout.show(m_pnlSampleName, VAST);
         m_trayTimer.start();
       }
       boolean bSample = bVast || !strSampleName.trim().equals("");
       m_pnlSampleName.setVisible(bSample);
       m_lblLogin.setForeground(getBackground());
       m_lblLogin.setVisible(false);
       m_passwordField.setText("");
       m_passwordField.setCaretPosition(0);
     } catch (Exception e) {
       Messages.writeStackTrace(e);
     }
     setBounds(frameBounds);
     ExpPanel exp = Util.getActiveView();
     if (exp != null) exp.waitLogin(true);
   }
   writePersistence();
   setVisible(bShow);
 }
예제 #26
0
  private void carregaConfig() {
    try {
      File file = new File("config.xml");
      SAXBuilder builder = new SAXBuilder();
      Document doc = builder.build(file);
      Element root = doc.getRootElement();
      List list = root.getChildren();
      Iterator i = list.iterator();

      while (i.hasNext()) {
        Element xml = (Element) i.next();

        Config c = new Config();
        c.setPathRouterSnapshot(xml.getChildText("pathRouterSnapshot"));
        c.setPathDestSnapshot(xml.getChildText("pathDestSnapshot"));
        c.setSmtpHostEmail(xml.getChildText("smtpHostEmail"));
        c.setSmtpPortEmail(Integer.parseInt(xml.getChildText("smtpPortEmail")));
        c.setUserEmail(xml.getChildText("userEmail"));
        c.setPassEmail(xml.getChildText("passEmail"));
        c.setHostFTP(xml.getChildText("hostFTP"));
        c.setPortaFTP(Integer.parseInt(xml.getChildText("portaFTP")));
        c.setUserFTP(xml.getChildText("userFTP"));
        c.setPassFTP(xml.getChildText("passFTP"));
        c.setPathDestFTP(xml.getChildText("pathDestFTP"));

        txtPathAlarmeRouter.setText(c.getPathRouterSnapshot());
        txtPathDestRouter.setText(c.getPathDestSnapshot());
        txtSmtpHostEmail.setText(c.getSmtpHostEmail());
        txtSmtpPortaEmail.setValue(c.getSmtpPortEmail());
        txtUserEmail.setText(c.getUserEmail());
        txtPassEmail.setText(c.getPassEmail());
        txtHostFTP.setText(c.getHostFTP());
        txtPortaFTP.setValue(c.getPortaFTP());
        txtUserFTP.setText(c.getUserFTP());
        txtPassFTP.setText(c.getPassFTP());
        txtPathDestFTP.setText(c.getPathDestFTP());
      }
    } catch (JDOMException ex) {
      System.out.println(ex.getMessage());
    } catch (IOException ex) {
      System.out.println(ex.getMessage());
    }
  }
예제 #27
0
파일: User.java 프로젝트: EtherFrog/iutjava
 private void jbInit() throws Exception {
   this.getContentPane().setLayout(null);
   Bienvenue.setFont(new java.awt.Font("Garamond", 1, 24));
   Bienvenue.setForeground(SystemColor.textHighlight);
   Bienvenue.setRequestFocusEnabled(true);
   Bienvenue.setVerifyInputWhenFocusTarget(true);
   Bienvenue.setText("Bienvenue dans JChat");
   Bienvenue.setBounds(new Rectangle(125, 28, 305, 44));
   Pseudo_L.setFont(new java.awt.Font("Dialog", 1, 14));
   Pseudo_L.setText("Pseudonyme :");
   Pseudo_L.setBounds(new Rectangle(75, 94, 128, 28));
   nom.setText("");
   nom.setBounds(new Rectangle(229, 95, 108, 24));
   pwd.setText("");
   pwd.setBounds(new Rectangle(230, 135, 108, 25));
   pwd_L.setFont(new java.awt.Font("Dialog", 1, 14));
   pwd_L.setText("Mot de passe :");
   pwd_L.setBounds(new Rectangle(76, 133, 122, 31));
   gestionnaire_B gestionnaire = new gestionnaire_B();
   Connect.addActionListener(gestionnaire);
   Connect.setBackground(new Color(239, 240, 234));
   Connect.setBounds(new Rectangle(281, 251, 142, 30));
   Connect.setText("Connexion");
   Connect.setIcon(new ImageIcon(image_c));
   Annuler.addActionListener(gestionnaire);
   Annuler.setBackground(new Color(239, 240, 234));
   Annuler.setBounds(new Rectangle(104, 252, 140, 29));
   Annuler.setText("Annuler");
   Annuler.setIcon(new ImageIcon(image_d));
   this.getContentPane().setBackground(new Color(239, 240, 234));
   this.setForeground(new Color(239, 240, 234));
   this.setTitle("Interface de connexion des clients au serveur de chat");
   jLabel1.setFont(new java.awt.Font("Dialog", 1, 14));
   jLabel1.setText("Adresse du serveur :");
   jLabel1.setBounds(new Rectangle(75, 176, 156, 26));
   jTextField1.setBounds(new Rectangle(230, 176, 108, 25));
   Icon siegle = new ImageIcon(image);
   siegle_L = new JLabel("", siegle, SwingConstants.LEFT);
   siegle_L.setBounds(new Rectangle(0, 1, 76, 105));
   this.getContentPane().add(jLabel1, null);
   this.getContentPane().add(pwd_L, null);
   this.getContentPane().add(Pseudo_L, null);
   this.getContentPane().add(jTextField1, null);
   this.getContentPane().add(nom, null);
   this.getContentPane().add(pwd, null);
   this.getContentPane().add(Bienvenue, null);
   this.getContentPane().add(Connect, null);
   this.getContentPane().add(Annuler, null);
   this.getContentPane().add(siegle_L, null);
   this.setSize(new Dimension(439, 321));
   this.setResizable(false);
   this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   this.setVisible(true);
 }
예제 #28
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;
 }
예제 #29
0
  public void setPreferencesProxyDTO(PreferencesProxyDTO preferencesProxyDTO) {
    switch (preferencesProxyDTO.getProxySettingType()) {
      case 0:
        noProxyRadioButton.setSelected(true);
        break;
      case 1:
        systemProxyRadioButton.setSelected(true);
        break;
      case 2:
        manualProxyRadioButton.setSelected(true);
    }

    if (preferencesProxyDTO.isUseProxyNotSocks()) useProxyRadioButton.setSelected(true);
    else useSocksRadioButton.setSelected(true);

    // for http
    httpProxyAddressTextField.setText(preferencesProxyDTO.getHttpProxyAddress());
    httpProxyPortSpinner.setValue(preferencesProxyDTO.getHttpProxyPort());
    httpProxyUserNameTextField.setText(preferencesProxyDTO.getHttpProxyUserName());
    httpProxyPasswordField.setText(preferencesProxyDTO.getHttpProxyPassword());

    // for https
    httpsProxyAddressTextField.setText(preferencesProxyDTO.getHttpsProxyAddress());
    httpsProxyPortSpinner.setValue(preferencesProxyDTO.getHttpsProxyPort());
    httpsProxyUserNameTextField.setText(preferencesProxyDTO.getHttpsProxyUserName());
    httpsProxyPasswordField.setText(preferencesProxyDTO.getHttpsProxyPassword());

    // for ftp
    ftpProxyAddressTextField.setText(preferencesProxyDTO.getFtpProxyAddress());
    ftpProxyPortSpinner.setValue(preferencesProxyDTO.getFtpProxyPort());
    ftpProxyUserNameTextField.setText(preferencesProxyDTO.getFtpProxyUserName());
    ftpProxyPasswordField.setText(preferencesProxyDTO.getFtpProxyPassword());

    // for ftp
    socksProxyAddressTextField.setText(preferencesProxyDTO.getSocksProxyAddress());
    socksProxyPortSpinner.setValue(preferencesProxyDTO.getSocksProxyPort());
    socksProxyUserNameTextField.setText(preferencesProxyDTO.getSocksProxyUserName());
    socksProxyPasswordField.setText(preferencesProxyDTO.getSocksProxyPassword());

    this.preferencesProxyDTO = preferencesProxyDTO;
  }
예제 #30
0
  /*
   * (non-Javadoc)
   *
   * @see
   * eu.europa.ec.markt.dss.commons.swing.mvc.applet.wizard.WizardView#wizardModelChange(java.beans.PropertyChangeEvent
   * )
   */
  @Override
  public void wizardModelChange(final PropertyChangeEvent evt) {

    if (evt.getPropertyName().equals(SignatureModel.PROPERTY_PKCS12_FILE)) {
      final File pkcs12File = getModel().getPkcs12File();
      final String text = pkcs12File == null ? I18N_NO_FILE_SELECTED : pkcs12File.getName();
      fileSourceLabel.setText(text);
      if (text.endsWith("user_a_rsa.p12")) {
        passwordField.setText("password");
      }
    }
  }