Hello there
i have this simple login function where i compare what you write with what is in the array and if it is the same it will open a new window else nothing will happen but it doesn't seem to work :/
can someone please help me what is wrong with my code?
login.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String[] usernameArray={"User1","User2","User3"}; //array where i save file username and a other one for password String[] passwordArray={"Pass1","Pass2","Pass3"}; for (int i=0; i<usernameArray.length; i++){ // make a for loop so it tjeks all the different users if((usernameField.equals(usernameArray[i]) && passwordField.equals(passwordArray[i]))){ JOptionPane.showMessageDialog(null,"Welcome "+usernameField+"\n"+"You are logged in"); login.addActionListener(new login()); dialog.setVisible(false); frame.setVisible(false); } } // end of for loop } });