1. design form login
2. double klik button login tersebut, copy paste source code dibawah
private void loginActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String user = "admin";
String pass = "123";
if( user.equalsIgnoreCase(username.getText()) && pass.equalsIgnoreCase(password.getText())) {
javax.swing.JOptionPane.showMessageDialog(null, "Login Succes");
this.setVisible(false);
new MenuHome().setVisible(true);//menuju form setelah login sukses
} else {
javax.swing.JOptionPane.showMessageDialog(null, "Maaf username atau password anda salah");
username.setText("");
password.setText("");
username.requestFocus();
}
// TODO add your handling code here:
}
3. double klik button cencel masukkan source code dibawah ini
this.dispose();
4.running
screenshot :





Post a Comment