示例#1
0
 /** Method for ok action. */
 private void okAction() {
   try {
     java.lang.String oldPassword = java.lang.String.valueOf(oldPasswordField.getPassword());
     java.lang.String newPassword = java.lang.String.valueOf(newPasswordField.getPassword());
     java.lang.String confirmedPassword =
         java.lang.String.valueOf(confirmedPasswordField.getPassword());
     if (!password.equals(oldPassword)) {
       javax.swing.JOptionPane.showMessageDialog(
           this,
           elv.util.Util.translate(elv.util.Util.OLD_STATEMENT),
           new elv.util.State(elv.util.State.ERROR).toString(),
           javax.swing.JOptionPane.ERROR_MESSAGE);
       oldPasswordField.setText(null);
       oldPasswordField.requestFocusInWindow();
       newPasswordField.setText(null);
       confirmedPasswordField.setText(null);
     } else if (!newPassword.equals(confirmedPassword)) {
       javax.swing.JOptionPane.showMessageDialog(
           this,
           elv.util.Util.translate(elv.util.Util.CONFIRMED_STATEMENT),
           new elv.util.State(elv.util.State.ERROR).toString(),
           javax.swing.JOptionPane.ERROR_MESSAGE);
       oldPasswordField.setText(null);
       oldPasswordField.requestFocusInWindow();
       newPasswordField.setText(null);
       confirmedPasswordField.setText(null);
     } else {
       password = newPassword;
       setVisible(false);
       dispose();
     }
   } catch (java.lang.Exception exc) {
     elv.util.Error.showErrorMessage(this, exc);
   }
 }
示例#2
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  private void initComponents() // GEN-BEGIN:initComponents
      {
    mainPanel = new javax.swing.JPanel();
    passwordsContentPanel = new javax.swing.JPanel();
    labelsPanel = new javax.swing.JPanel();
    oldLabel = new javax.swing.JLabel();
    newLabel = new javax.swing.JLabel();
    confirmedLabel = new javax.swing.JLabel();
    inputsPanel = new javax.swing.JPanel();
    oldPasswordField = new javax.swing.JPasswordField();
    newPasswordField = new javax.swing.JPasswordField();
    confirmedPasswordField = new javax.swing.JPasswordField();
    buttonsOrientationPanel = new javax.swing.JPanel();
    mainSeparator = new javax.swing.JSeparator();
    buttonsPanel = new javax.swing.JPanel();
    okButton = new javax.swing.JButton();
    cancelButton = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setModal(true);
    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            closeDialog(evt);
          }
        });

    mainPanel.setLayout(new java.awt.BorderLayout());

    passwordsContentPanel.setLayout(new java.awt.BorderLayout());

    labelsPanel.setLayout(new java.awt.GridLayout(0, 1, 0, 10));

    labelsPanel.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(10, 10, 10, 10)));
    oldLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    oldLabel.setLabelFor(oldPasswordField);
    oldLabel.setText(elv.util.Util.translate(elv.util.Util.OLD_VALUE) + ":");
    labelsPanel.add(oldLabel);

    newLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    newLabel.setLabelFor(newPasswordField);
    newLabel.setText(elv.util.Util.translate(elv.util.Util.NEW_VALUE) + ":");
    labelsPanel.add(newLabel);

    confirmedLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    confirmedLabel.setLabelFor(confirmedPasswordField);
    confirmedLabel.setText(elv.util.Util.translate(elv.util.Util.CONFIRMED_VALUE) + ":");
    labelsPanel.add(confirmedLabel);

    passwordsContentPanel.add(labelsPanel, java.awt.BorderLayout.WEST);

    inputsPanel.setLayout(new java.awt.GridLayout(0, 1, 0, 10));

    inputsPanel.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(10, 1, 10, 10)));
    oldPasswordField.setFont(new java.awt.Font("DialogInput", 0, 12));
    oldPasswordField.setEchoChar(elv.util.Util.PASSWORD_ECHO_CHAR);
    oldPasswordField.setPreferredSize(new java.awt.Dimension(150, 18));
    inputsPanel.add(oldPasswordField);

    newPasswordField.setFont(new java.awt.Font("DialogInput", 0, 12));
    newPasswordField.setEchoChar(elv.util.Util.PASSWORD_ECHO_CHAR);
    inputsPanel.add(newPasswordField);

    confirmedPasswordField.setFont(new java.awt.Font("DialogInput", 0, 12));
    confirmedPasswordField.setEchoChar(elv.util.Util.PASSWORD_ECHO_CHAR);
    inputsPanel.add(confirmedPasswordField);

    passwordsContentPanel.add(inputsPanel, java.awt.BorderLayout.CENTER);

    mainPanel.add(passwordsContentPanel, java.awt.BorderLayout.CENTER);

    getContentPane().add(mainPanel, java.awt.BorderLayout.CENTER);

    buttonsOrientationPanel.setLayout(new java.awt.BorderLayout());

    buttonsOrientationPanel.add(mainSeparator, java.awt.BorderLayout.NORTH);

    buttonsPanel.setLayout(new java.awt.GridLayout(1, 0, 5, 0));

    buttonsPanel.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(10, 10, 10, 10)));
    okButton.setText(new elv.util.Action(elv.util.Action.OK).toString());
    okButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            okButtonActionPerformed(evt);
          }
        });

    buttonsPanel.add(okButton);

    cancelButton.setText(new elv.util.Action(elv.util.Action.CANCEL).toString());
    cancelButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancelButtonActionPerformed(evt);
          }
        });

    buttonsPanel.add(cancelButton);

    buttonsOrientationPanel.add(buttonsPanel, java.awt.BorderLayout.EAST);

    getContentPane().add(buttonsOrientationPanel, java.awt.BorderLayout.SOUTH);

    pack();
  } // GEN-END:initComponents
示例#3
0
 /**
  * Implemented method from <CODE>elv.util.parameters.Parameter</CODE>.
  *
  * @return the title of parameter.
  */
 public java.lang.String getTitle() {
   return elv.util.Util.translate(TITLE);
 }