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);
    }
  }
Exemple #2
0
 public void actionPerformed(ActionEvent evt) // event handling
     {
   // Object source = evt.getSource(); //get who generates this event
   String arg = evt.getActionCommand();
   if (arg.equals("Register")) { // determine which button is clicked
     UName = UsernameField.getText(); // take actions
     PsWord = PasswordField.getText();
     PsWord1 = PasswordField1.getText();
     Acct = new Account(UName, PsWord, PsWord1);
     if (Acct.signUp())
       JOptionPane.showMessageDialog(
           null, "Account has been created!", "Confirmation", JOptionPane.INFORMATION_MESSAGE);
     else
       JOptionPane.showMessageDialog(
           null,
           "Account creation failed due to an invalid email address or unmatched passwords or the email address exists.",
           "Confirmation",
           JOptionPane.INFORMATION_MESSAGE);
   }
 }
Exemple #3
0
 public void actionPerformed(ActionEvent ae) {
   String user = t1.getText();
   String pass = t2.getText();
   if (ae.getSource() == b1) {
     if (pass.equals("netmon")) {
       NetPac pAn = new NetPac();
       this.setVisible(false);
     } else {
       JOptionPane.showMessageDialog(null, "Error!! Enter correct password.");
     }
   }
 }
 private void onOK() {
   try {
     Map<String, String> data = new HashMap<String, String>();
     data.put("login", loginField.getText());
     data.put("password", passwordField.getText());
     String errorMsg = SocketManager.doAction(Constants.LOGIN_ACTION, data);
     if (errorMsg.equals("0")) {
       MainView mainView = new MainView();
       mainView.setVisible(true);
       dispose();
     } else {
       JOptionPane.showMessageDialog(this, errorMsg, "Error!", JOptionPane.ERROR_MESSAGE);
     }
   } catch (IOException e) {
     JOptionPane.showMessageDialog(this, e.getMessage(), "Error!", JOptionPane.ERROR_MESSAGE);
   }
 }
  @SuppressWarnings("deprecation")
  public void logar() {
    SistemaAcesso sist = new SistemaAcesso();
    sist.addArrayList();

    try {
      if (sist.buscarLogin(tlogin.getText(), tsenha.getText())) {

        GUIMenuPrincipal menu = new GUIMenuPrincipal(bn, sist.getPerfil(), sist.getAgencia());
        menu.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        dispose();
      } else {
        tsenha.setText("");
        tlogin.setText("");
        JOptionPane.showMessageDialog(null, "Login e/ou senha incorretos");
        tlogin.requestFocus();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemple #6
0
  public void actionPerformed(ActionEvent e) {
    String s = new String(e.getActionCommand());

    if ((s).equals("Login")) {
      try {
        if (factory.authenticate(username.getText(), password.getText())) {
          loginFrame.dispose();
          new HomeScreen(factory);
        } else {
          JOptionPane.showMessageDialog(loginFrame, "Username or Password is incorrect.");
        }
      } catch (SQLException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      }

    } else if ((s).equals("Cancel")) {
      loginFrame.dispose();
      new ExitListener();
    }
  }
Exemple #7
0
  public void actionPerformed(ActionEvent e) {
    p2.str1 = fn1.getText();
    p2.str2 = ln1.getText();
    p2.str3 = un1.getText();
    p2.str4 = ps11.getText();
    p2.str5 = eid1.getText();
    p2.str6 = ps21.getText();
    p2.str7 = mb1.getText();
    p2.str8 = cct1.getText();
    p2.str9 = hquali1.getText();
    p2.str10 = dober1.getText();
    p2.str11 = dober2.getText();
    p2.str12 = dober3.getText();
    p2.str13 = p2.str10 + "/" + p2.str11 + "/" + p2.str12;

    boolean bl1, bl2, bl3, bl4, bl5, bl6, bl7, bl8, bl9;
    bl1 = false;
    bl2 = false;
    bl3 = false;
    bl4 = false;
    bl5 = false;
    bl6 = false;
    bl7 = false;
    bl8 = false;

    if (str1.length() > 0) {
      // er1.setForeground(null);
      er1.setText("");
      fn1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl1 = true;
      repaint();
    } else {
      er1.setForeground(Color.red);
      er1.setText("(First name can't be null)");
      fn1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }

    if (str3.length() > 0) {
      er3.setText("");
      un1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl2 = true;
      repaint();

    } else {
      er3.setForeground(Color.red);
      er3.setText("(Username can't be null)");
      un1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }

    if (str5.length() > 0) {
      er6.setText("");
      eid1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl3 = true;
      repaint();

    } else {
      er6.setForeground(Color.red);
      er6.setText("(email id can't be null)");
      eid1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }

    if (str4.length() > 0) {
      er4.setText("");
      ps11.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl4 = true;
      repaint();

    } else {
      er4.setForeground(Color.red);
      er4.setText("(Password can't be null)");
      ps11.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }

    if ((str4.equals(str6))) {
      str6 = str4;
      er5.setForeground(null);
      er5.setText("");
      ps21.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl5 = true;
      repaint();

    } else {
      er5.setForeground(Color.red);
      er5.setText("(both pwd should be same)");
      ps21.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }
    if (str7.length() == 10) {
      er7.setText("");
      mb1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl6 = true;
      repaint();

    } else {
      er7.setForeground(Color.red);
      er7.setText("(number should be of 10 digit)");
      mb1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }
    if (str8.length() > 0) {
      er8.setText("");
      cct1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl7 = true;
      repaint();

    } else {
      er8.setForeground(Color.red);
      er8.setText("(Current City can't be null)");
      cct1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }
    if (str9.length() > 0) {
      er9.setText("");
      hquali1.setBorder(BorderFactory.createLineBorder(Color.GRAY));
      bl8 = true;
      repaint();

    } else {
      er9.setForeground(Color.red);
      er9.setText("(Highest Qualif. can't be null)");
      hquali1.setBorder(BorderFactory.createLineBorder(Color.red));
      repaint();
    }

    try {
      if ((bl1 && bl2 && bl3 && bl4 && bl5 && bl6 && bl7 && bl8) == true) {
        JOptionPane.showMessageDialog(null, "Data submitting ");
        p2.goer();
      }
    } catch (Exception e3) {
    }
  }