views:

67

answers:

0

I am creating a login form in java by having a database connection, and I need 2 open DIFFERENT forms for each user. However, all of the three forms open except for one. The forms I have are, MAinWindow Nursery Primary Secondary ALL THE FORMS OPEN except for the nursery form, when I enter the correct username it displays the Primary form. ANY HELP SOON

            char[] DBUserArray;
            DBUserArray=name.toCharArray();
            char [] DBPassArray;
            DBPassArray=pass.toCharArray();


            char AdminArray []=AdminUser.toCharArray();
            char NurArray []=NurHead.toCharArray();
            char[] PriArray =PriHead.toCharArray();
            char[] SecArray=SecHead.toCharArray();

            char[] input = txtpassword.getPassword();
            String user=txtusername.getText();
            char [] userString;
            userString=user.toCharArray();

        if(userString.length!=DBUserArray.length && input.length!=DBPassArray.length)

        {
           JOptionPane.showMessageDialog(null, "Username and Password Wrong","User Login",JOptionPane.ERROR_MESSAGE);
        }
        else
        {
             if(userString.length!=AdminArray.length)
            {
                if(userString.length!=PriArray.length)
                {
                    if(userString.length!=NurArray.length)
                    {
                        if(userString.length!=SecArray.length)
                        {

                        }
                        else
                        {
                            new Secondary().setVisible(true);
                            setVisible(false);
                        }
                    }
                    else
                    {
                        new Nursery().setVisible(true);
                        setVisible(false);
                    }
               }
               else
               {
                    new Primary().setVisible(true);
                    setVisible(false);
               }
             }
             else
             {
                 new MainWindow().setVisible(true);
                 setVisible(false);
             }
        }