Advertisement
Guest User

registration

a guest
Mar 18th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.44 KB | None | 0 0
  1. private void btnSignUpActionPerformed(java.awt.event.ActionEvent evt) {
  2.     String nama = txtUserName.getText();
  3.     String pass = txtPassword.getText();
  4.     String pass1 = txtRetypePassword.getText();
  5.     if(pass == null ? pass1 != null : !pass.equals(pass1)){            
  6.         JOptionPane.showMessageDialog(rootPane,
  7.         "Password didn't match.",
  8.         "Form Error",
  9.         JOptionPane.WARNING_MESSAGE);            
  10.        
  11.         txtUserName.setText("");
  12.         txtPassword.setText("");
  13.         txtRetypePassword.setText("");            
  14.     }else{
  15.         try {
  16.             DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
  17.             Date date = new Date();
  18.             String tgl = dateFormat.format(date);
  19.            
  20.             int tambahUser = src.id.lib.insertData.insertUser(nama, pass, tgl);
  21.  
  22.             if(tambahUser == 1){
  23.                 JOptionPane.showMessageDialog(rootPane,
  24.                 "Creating user success.");
  25.             }
  26.             new Login().show();  
  27.             this.dispose();
  28.            
  29.         } catch (SQLException ex) {
  30.             Logger.getLogger(Mahasiswa.class.getName()).log(Level.SEVERE, null, ex);
  31.         }
  32.     }
  33. }                                        
  34. private void btnResetActionPerformed(java.awt.event.ActionEvent evt) {
  35.     txtUserName.setText("");
  36.     txtPassword.setText("");
  37.     txtRetypePassword.setText("");
  38. }
  39. public static void main(String args[]) throws UnsupportedLookAndFeelException{
  40.     UIManager.setLookAndFeel(new AcrylLookAndFeel());
  41.     java.awt.EventQueue.invokeLater(new Runnable() {
  42.         public void run() {
  43.             new Registration().setVisible(true);
  44.         }
  45.     });
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement