I am using Netbeans 7.1
I have 2 jFrame
JFrame1 and JFrame2
I just not able to close or hide the JFrame1 when I switch to JFrame2
This is the JFrame1 Code -
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try{
int flag=0;
String sql="Select * from login;";
smt1=con.createStatement();
rs=smt1.executeQuery(sql);
String log=jTextField1.getText();
String pass =new String(jPasswordField1.getPassword());
while(rs.next())
{
if(log.equals(rs.getString(1)) && pass.equals(rs.getString(2)))
{
flag=1;
break;
}
}
if(flag==1)
{
jLabel3.setEnabled(false);
jLabel4.setEnabled(false);
jTextField1.setEnabled(false);
jPasswordField1.setEnabled(false);
jButton1.setEnabled(false);
jButton2.setEnabled(false);
JFrame1 nf=new JFrame1(); // **SECOND JFRAME WHICH IS OPENED** //
nf.setVisible(true);
}
else
{
JOptionPane.showMessageDialog(this, "Error", "Please check user name / password",JOptionPane.ERROR_MESSAGE);
}
}
catch(Exception ex){
}
}
But now I am not able to hide the JFrame1 once JFrame2 is shown.
Please show some way