Click here to Skip to main content
15,902,447 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi. I am creating a project in which i have created a Admin login frame.I have given here adminname text field ,password field and a login button. when i entered correct adminname and password then a new frame open named Admin panel. the thing i want is to close the admin login frame and open admin Panel on clicking the login button.

please help me.
thanx in advanced
Posted

Java
public void actionPerformed(ActionEvent arg0)
 {
        new GUI();//next frame
        dispose();
 }

or frame1.setVisible(false);
can help u.
 
Share this answer
 
v2
 
Share this answer
 
Use this:
Java
loginButton.addActionListener(new ActionListener() {
                 public void actionPerformed(ActionEvent e)
                 {


                  if(//check if the admin and password are corect){
                     frameToClose.dispose();//dispose previous frame
                     //create the other frame or set its setVisible()method to true
                   }else{

                     //display error message
                     //something like incorrect user or password
                   }

                 }
        });


It should work.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900