예제 #1
0
    private void launch() {

      head = new JLabel();
      old = new JLabel();
      new1 = new JLabel();
      new2 = new JLabel();
      pas1 = new JPasswordField();
      JTextComponent.KeyBinding[] newBindings = {
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction),
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction),
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction)
      };

      Keymap k = pas1.getKeymap();
      JTextComponent.loadKeymap(k, newBindings, pas1.getActions());
      pas2 = new JPasswordField();

      Keymap k2 = pas2.getKeymap();
      JTextComponent.loadKeymap(k2, newBindings, pas2.getActions());
      pas3 = new JPasswordField();

      Keymap k3 = pas3.getKeymap();
      JTextComponent.loadKeymap(k3, newBindings, pas3.getActions());
      XrButton sub = new XrButton(new ImageIcon("Bin\\img\\ok.png"));

      sub.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              if (pas1.getText().equals(pwd)) {
                if ((pas1.getText().equalsIgnoreCase(""))
                    || (pas1.getText().equalsIgnoreCase(null))
                    || (pas2.getText().equalsIgnoreCase(""))
                    || (pas2.getText().equalsIgnoreCase(null))
                    || (pas3.getText().equalsIgnoreCase(""))
                    || (pas3.getText().equalsIgnoreCase(null))) {
                  JOptionPane.showMessageDialog(
                      null, "Please all the text fields", "Error", JOptionPane.ERROR_MESSAGE);
                } else {
                  if ((pas2.getText().equalsIgnoreCase(pas3.getText()))) {
                    String r = update(pas2.getText());
                    if (r.equalsIgnoreCase("ok")) {
                      JOptionPane.showMessageDialog(
                          null, "Updated....", "Alert", JOptionPane.INFORMATION_MESSAGE);
                    } else {
                      JOptionPane.showMessageDialog(
                          null,
                          "Encountered Error cant update..",
                          "Error",
                          JOptionPane.ERROR_MESSAGE);
                    }
                  } else {
                    JOptionPane.showMessageDialog(
                        null, "New password do not match", "Error", JOptionPane.ERROR_MESSAGE);
                  }
                }
              } else {
                JOptionPane.showMessageDialog(
                    null, "Incorrect old password", "Error", JOptionPane.ERROR_MESSAGE);
              }
              dispose();
            }
          });

      head.setFont(new Font("Verdana", 1, 16));
      head.setText("Change Password");

      old.setFont(new Font("Verdana", 0, 12));
      old.setText("Old Password");

      new1.setFont(new Font("Verdana", 0, 12));
      new1.setText("New Password");

      new2.setFont(new Font("Verdana", 0, 12));
      new2.setText("Confirm Password");

      sub.setToolTipText("Submit");

      GroupLayout layout = new GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
          layout
              .createParallelGroup(GroupLayout.Alignment.LEADING)
              .addGroup(
                  layout
                      .createSequentialGroup()
                      .addGap(57, 57, 57)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.LEADING)
                              .addComponent(old)
                              .addComponent(new1)
                              .addComponent(new2))
                      .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.LEADING)
                              .addComponent(
                                  pas1, GroupLayout.PREFERRED_SIZE, 123, GroupLayout.PREFERRED_SIZE)
                              .addComponent(
                                  pas2, GroupLayout.PREFERRED_SIZE, 123, GroupLayout.PREFERRED_SIZE)
                              .addComponent(
                                  pas3,
                                  GroupLayout.PREFERRED_SIZE,
                                  123,
                                  GroupLayout.PREFERRED_SIZE))
                      .addContainerGap(57, Short.MAX_VALUE))
              .addGroup(
                  GroupLayout.Alignment.TRAILING,
                  layout
                      .createSequentialGroup()
                      .addContainerGap(166, Short.MAX_VALUE)
                      .addComponent(sub)
                      .addGap(161, 161, 161))
              .addGroup(
                  GroupLayout.Alignment.TRAILING,
                  layout
                      .createSequentialGroup()
                      .addContainerGap(122, Short.MAX_VALUE)
                      .addComponent(head)
                      .addGap(119, 119, 119)));
      layout.setVerticalGroup(
          layout
              .createParallelGroup(GroupLayout.Alignment.LEADING)
              .addGroup(
                  layout
                      .createSequentialGroup()
                      .addGap(31, 31, 31)
                      .addComponent(head)
                      .addGap(50, 50, 50)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.TRAILING)
                              .addComponent(old)
                              .addComponent(
                                  pas1,
                                  GroupLayout.PREFERRED_SIZE,
                                  GroupLayout.DEFAULT_SIZE,
                                  GroupLayout.PREFERRED_SIZE))
                      .addGap(30, 30, 30)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.TRAILING)
                              .addComponent(new1)
                              .addComponent(
                                  pas2,
                                  GroupLayout.PREFERRED_SIZE,
                                  GroupLayout.DEFAULT_SIZE,
                                  GroupLayout.PREFERRED_SIZE))
                      .addGap(28, 28, 28)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.TRAILING)
                              .addComponent(new2)
                              .addComponent(
                                  pas3,
                                  GroupLayout.PREFERRED_SIZE,
                                  GroupLayout.DEFAULT_SIZE,
                                  GroupLayout.PREFERRED_SIZE))
                      .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 35, Short.MAX_VALUE)
                      .addComponent(sub)
                      .addGap(22, 22, 22)));
      addWindowListener(
          new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              setVisible(false);
            }
          });
      setIconImage(Toolkit.getDefaultToolkit().getImage("Bin\\img\\airindia.jpg"));
      setLocation(h / 2, w / 7);
      setResizable(false);
      setTitle("Change Password");
      pack();
    }
예제 #2
0
    private void launch() {

      head = new JLabel();
      email = new JLabel();
      pas = new JLabel();
      pass = new JPasswordField();
      JTextComponent.KeyBinding[] newBindings = {
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction),
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction),
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction)
      };

      Keymap k = pass.getKeymap();
      JTextComponent.loadKeymap(k, newBindings, pass.getActions());
      mail = new JTextField();
      XrButton sub = new XrButton(new ImageIcon("Bin\\img\\ok.png"));

      head.setFont(new Font("Verdana", 1, 16));
      head.setText("Change Email ID");

      email.setFont(new Font("Verdana", 0, 12));
      email.setText("Enter New Email ID");

      pas.setFont(new Font("Verdana", 0, 12));
      pas.setText("Enter the Password");

      sub.setToolTipText("Submit");
      sub.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              if (pass.getText().equals(pwd)) {
                if ((mail.getText().equalsIgnoreCase(null))
                    || (mail.getText().equalsIgnoreCase(""))) {
                  JOptionPane.showMessageDialog(
                      null, "Please Enter the new email id", "Error", JOptionPane.ERROR_MESSAGE);
                } else {
                  String r = update(mail.getText());
                  if (r.equalsIgnoreCase("ok")) {
                    JOptionPane.showMessageDialog(
                        null, "Updated....", "Alert", JOptionPane.INFORMATION_MESSAGE);
                  } else {
                    JOptionPane.showMessageDialog(
                        null,
                        "Encountered Error cant update..",
                        "Error",
                        JOptionPane.ERROR_MESSAGE);
                  }
                }
              } else {

                JOptionPane.showMessageDialog(
                    null, "Incorrect Password", "Error", JOptionPane.ERROR_MESSAGE);
              }
              dispose();
            }
          });

      GroupLayout layout = new GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
          layout
              .createParallelGroup(GroupLayout.Alignment.LEADING)
              .addGroup(
                  layout
                      .createSequentialGroup()
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.LEADING)
                              .addGroup(
                                  layout
                                      .createSequentialGroup()
                                      .addGap(118, 118, 118)
                                      .addComponent(head))
                              .addGroup(
                                  layout
                                      .createSequentialGroup()
                                      .addGap(77, 77, 77)
                                      .addGroup(
                                          layout
                                              .createParallelGroup(GroupLayout.Alignment.LEADING)
                                              .addComponent(pas)
                                              .addComponent(email))
                                      .addGap(27, 27, 27)
                                      .addGroup(
                                          layout
                                              .createParallelGroup(
                                                  GroupLayout.Alignment.LEADING, false)
                                              .addComponent(mail)
                                              .addComponent(
                                                  pass,
                                                  GroupLayout.DEFAULT_SIZE,
                                                  140,
                                                  Short.MAX_VALUE))))
                      .addContainerGap(31, Short.MAX_VALUE))
              .addGroup(
                  GroupLayout.Alignment.TRAILING,
                  layout
                      .createSequentialGroup()
                      .addContainerGap(165, Short.MAX_VALUE)
                      .addComponent(sub)
                      .addGap(170, 170, 170)));
      layout.setVerticalGroup(
          layout
              .createParallelGroup(GroupLayout.Alignment.LEADING)
              .addGroup(
                  layout
                      .createSequentialGroup()
                      .addGap(38, 38, 38)
                      .addComponent(head)
                      .addGap(48, 48, 48)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.TRAILING)
                              .addComponent(email)
                              .addComponent(
                                  mail,
                                  GroupLayout.PREFERRED_SIZE,
                                  GroupLayout.DEFAULT_SIZE,
                                  GroupLayout.PREFERRED_SIZE))
                      .addGap(29, 29, 29)
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.LEADING)
                              .addComponent(pas, GroupLayout.Alignment.TRAILING)
                              .addComponent(
                                  pass,
                                  GroupLayout.Alignment.TRAILING,
                                  GroupLayout.PREFERRED_SIZE,
                                  GroupLayout.DEFAULT_SIZE,
                                  GroupLayout.PREFERRED_SIZE))
                      .addGap(45, 45, 45)
                      .addComponent(sub)
                      .addContainerGap(56, Short.MAX_VALUE)));
      addWindowListener(
          new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              setVisible(false);
            }
          });
      setIconImage(Toolkit.getDefaultToolkit().getImage("Bin\\img\\airindia.jpg"));
      setLocation(h / 2, w / 7);
      setResizable(false);
      setTitle("Change Email");
      pack();
    }
예제 #3
0
    private void launch() {

      head = new JLabel();
      pas = new JPasswordField();
      JTextComponent.KeyBinding[] newBindings = {
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction),
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction),
        new JTextComponent.KeyBinding(
            KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK),
            DefaultEditorKit.beepAction)
      };

      Keymap k = pas.getKeymap();
      JTextComponent.loadKeymap(k, newBindings, pas.getActions());
      XrButton sub = new XrButton(new ImageIcon("Bin\\img\\ok.png"));

      head.setFont(new Font("Verdana", 1, 16));
      head.setText("Employee ID: " + emp + " please enter the password");

      sub.setFont(new Font("Verdana", 1, 12));
      sub.setToolTipText("Submit");

      sub.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              String pwd = new CheckQuery(emp).search(rav);
              if ((pas.getText().equalsIgnoreCase(null)) || (pas.getText().equalsIgnoreCase(""))) {
                JOptionPane.showMessageDialog(
                    null, "Please Enter the Password", "Error", JOptionPane.ERROR_MESSAGE);
              } else if (pas.getText().equalsIgnoreCase(pwd)) {
                dispose();
                merge();
              } else {
                JOptionPane.showMessageDialog(
                    null, "Oops Incorrect Password", "Error", JOptionPane.ERROR_MESSAGE);
              }
            }
          });

      GroupLayout layout = new GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
          layout
              .createParallelGroup(GroupLayout.Alignment.LEADING)
              .addGroup(
                  layout
                      .createSequentialGroup()
                      .addGroup(
                          layout
                              .createParallelGroup(GroupLayout.Alignment.LEADING)
                              .addGroup(
                                  layout
                                      .createSequentialGroup()
                                      .addGap(196, 196, 196)
                                      .addComponent(sub))
                              .addGroup(
                                  layout
                                      .createSequentialGroup()
                                      .addGap(31, 31, 31)
                                      .addComponent(head))
                              .addGroup(
                                  layout
                                      .createSequentialGroup()
                                      .addGap(126, 126, 126)
                                      .addComponent(
                                          pas,
                                          GroupLayout.PREFERRED_SIZE,
                                          216,
                                          GroupLayout.PREFERRED_SIZE)))
                      .addContainerGap(34, Short.MAX_VALUE)));
      layout.setVerticalGroup(
          layout
              .createParallelGroup(GroupLayout.Alignment.LEADING)
              .addGroup(
                  layout
                      .createSequentialGroup()
                      .addGap(33, 33, 33)
                      .addComponent(head)
                      .addGap(45, 45, 45)
                      .addComponent(
                          pas,
                          GroupLayout.PREFERRED_SIZE,
                          GroupLayout.DEFAULT_SIZE,
                          GroupLayout.PREFERRED_SIZE)
                      .addGap(56, 56, 56)
                      .addComponent(sub)
                      .addContainerGap(42, Short.MAX_VALUE)));
      addWindowListener(
          new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              setVisible(false);
            }
          });
      setIconImage(Toolkit.getDefaultToolkit().getImage("Bin\\img\\airindia.jpg"));
      setLocation(h / 2, w / 7);
      setResizable(false);
      setTitle("Authentication");
      pack();
    }