Java, .NET, PHP, PYTHON, ANGULAR, .NET, ML, Data Scince, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

Navigation in Swing Frame in Java:-



How to navigate from one frame to another in Swing?

To navigate from one frame to another we will create Object of Destination frame and call setVisible().



Code for Navigation:-

1 Create Login Jframe with this design screen








2) Create Another JFrame Dashboard Frame



3) Write Code on Login JFrame Button

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                       
        if(jTextField1.getText().toString().equals("admin") && jPasswordField1.getText().toString().equals("12345"))
        {
            //new Dashboard().setVisible(true);
           Dashboard Obj = new Dashboard();
           obj.setVisible(true);
        }
        else
        {
            JOptionPane.showMessageDialog(null, "Invalid Userid and password");
        }
    }   





Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post