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");
}
}
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 Answer of Questions and ASK to Doubt