Guest User

Untitled

a guest
Apr 26th, 2018
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1.  
  2. Conversation opened. 1 unread message.
  3.  
  4. Skip to content
  5. Using Gmail with screen readers
  6. Click here to enable desktop notifications for Gmail. Learn more Hide
  7. 1 of 378
  8.  
  9. Java Login Form
  10. Inbox
  11. x
  12.  
  13. Aman Chaturvedi <dmrnigdi@gmail.com>
  14. 7:01 PM (19 minutes ago)
  15. to me
  16. package Lightapp;
  17. import java.sql.* ;
  18. import javax.swing.* ;
  19.  
  20. public class AbbeyLog extends javax.swing.JFrame
  21. {
  22. Connection conn = null;
  23. ResultSet rs = null;
  24. PreparedStatement pst = null;
  25.  
  26. /**
  27. * Creates new form AbbeyLog
  28. */
  29. public AbbeyLog()
  30. {
  31. initComponents();
  32. }
  33.  
  34. @SuppressWarnings("unchecked")
  35. private void textuserActionPerformed(java.awt.event.ActionEvent evt)
  36. {
  37. // TODO add your handling code here:
  38. String sql = "select * from login where username = ? and password = ?";
  39. try
  40. {
  41. pst = conn.prepareStatement(sql);
  42. pst.setString(1, textuser.getText());
  43. pst.setString(2, textpass.getText());
  44. rs = pst.executeQuery();
  45. if (rs.next())
  46. {
  47. JOptionPane.showMessageDialog(null, "Username and Password correct");
  48. }
  49. else
  50. {
  51. JOptionPane.showMessageDialog(null, "invalid username and password");
  52. }
  53. }
  54. catch (Exception e)
  55. {
  56. JOptionPane.showMessageDialog(null, e);
  57. }
  58. }
  59.  
  60. private void textuserMouseClicked(java.awt.event.MouseEvent evt)
  61. {
  62. // TODO add your handling code here:
  63. }
  64.  
  65.  
  66. public static void main(String args[])
  67. {
  68. /* Create and display the form */
  69. java.awt.EventQueue.invokeLater(new Runnable()
  70. {
  71. public void run()
  72. {
  73. new AbbeyLog().setVisible(true);
  74. }
  75. });
  76. }
  77.  
  78. // Variables declaration - do not modify
  79. private javax.swing.JButton jButton2;
  80. private javax.swing.JLabel jLabel1;
  81. private javax.swing.JLabel jLabel2;
  82. private javax.swing.JPanel jPanel1;
  83. private javax.swing.JPanel jPanel2;
  84. private javax.swing.JTextField jTextField1;
  85. private javax.swing.JTextField textpass;
  86. private javax.swing.JButton textuser;
  87. // End of variables declaration
  88. }
  89.  
  90.  
  91. Click here to Reply or Forward
  92. 2.3 GB (15%) of 15 GB used
  93. Manage
  94. Terms - Privacy
  95. Last account activity: 19 minutes ago
  96. Details
Add Comment
Please, Sign In to add comment