Navigation in Swing Frame in Java

0

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");
        }
    }   
Tags

Post a Comment

0Comments

POST Answer of Questions and ASK to Doubt

Post a Comment (0)