Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.01 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package guilogin;
  7.  
  8. import javax.swing.JOptionPane;
  9.  
  10. /**
  11. *
  12. * @author Jaykn
  13. */
  14. public class LoginPageUI extends javax.swing.JFrame {
  15.  
  16. /**
  17. * Creates new form LoginPageUI
  18. */
  19. public LoginPageUI() {
  20. initComponents();
  21. }
  22.  
  23. /**
  24. * This method is called from within the constructor to initialize the form.
  25. * WARNING: Do NOT modify this code. The content of this method is always
  26. * regenerated by the Form Editor.
  27. */
  28. @SuppressWarnings("unchecked")
  29. // <editor-fold defaultstate="collapsed" desc="Generated Code">
  30. private void initComponents() {
  31.  
  32. jPanel1 = new javax.swing.JPanel();
  33. jLabel1 = new javax.swing.JLabel();
  34. jLabel2 = new javax.swing.JLabel();
  35. Username1 = new javax.swing.JTextField();
  36. Password1 = new javax.swing.JPasswordField();
  37. Cancelbtn = new javax.swing.JToggleButton();
  38. Loginbtn = new javax.swing.JToggleButton();
  39. jLabel4 = new javax.swing.JLabel();
  40.  
  41. setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  42.  
  43. jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
  44.  
  45. jLabel1.setText("Username");
  46.  
  47. jLabel2.setText("Password");
  48.  
  49. Username1.addActionListener(new java.awt.event.ActionListener() {
  50. public void actionPerformed(java.awt.event.ActionEvent evt) {
  51. Username1ActionPerformed(evt);
  52. }
  53. });
  54.  
  55. Password1.addActionListener(new java.awt.event.ActionListener() {
  56. public void actionPerformed(java.awt.event.ActionEvent evt) {
  57. Password1ActionPerformed(evt);
  58. }
  59. });
  60.  
  61. Cancelbtn.setText("Cancel");
  62. Cancelbtn.addActionListener(new java.awt.event.ActionListener() {
  63. public void actionPerformed(java.awt.event.ActionEvent evt) {
  64. CancelbtnActionPerformed(evt);
  65. }
  66. });
  67.  
  68. Loginbtn.setText("Login");
  69. Loginbtn.addActionListener(new java.awt.event.ActionListener() {
  70. public void actionPerformed(java.awt.event.ActionEvent evt) {
  71. LoginbtnActionPerformed(evt);
  72. }
  73. });
  74.  
  75. jLabel4.setText("Software Login Screen");
  76.  
  77. javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
  78. jPanel1.setLayout(jPanel1Layout);
  79. jPanel1Layout.setHorizontalGroup(
  80. jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  81. .addGroup(jPanel1Layout.createSequentialGroup()
  82. .addGap(109, 109, 109)
  83. .addComponent(Loginbtn)
  84. .addGap(49, 49, 49)
  85. .addComponent(Cancelbtn)
  86. .addContainerGap(104, Short.MAX_VALUE))
  87. .addGroup(jPanel1Layout.createSequentialGroup()
  88. .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  89. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  90. .addComponent(jLabel1)
  91. .addComponent(jLabel2))
  92. .addGap(18, 18, 18)
  93. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  94. .addComponent(Username1, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
  95. .addComponent(Password1, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
  96. .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  97. .addGroup(jPanel1Layout.createSequentialGroup()
  98. .addGap(118, 118, 118)
  99. .addComponent(jLabel4)
  100. .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  101. );
  102. jPanel1Layout.setVerticalGroup(
  103. jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  104. .addGroup(jPanel1Layout.createSequentialGroup()
  105. .addGap(46, 46, 46)
  106. .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
  107. .addGap(17, 17, 17)
  108. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  109. .addGroup(jPanel1Layout.createSequentialGroup()
  110. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  111. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  112. .addComponent(Username1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  113. .addComponent(jLabel1))
  114. .addGap(18, 18, 18)
  115. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  116. .addComponent(Password1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  117. .addComponent(jLabel2))
  118. .addGap(112, 112, 112))
  119. .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
  120. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  121. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  122. .addComponent(Loginbtn)
  123. .addComponent(Cancelbtn))
  124. .addGap(37, 37, 37))))
  125. );
  126.  
  127. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  128. getContentPane().setLayout(layout);
  129. layout.setHorizontalGroup(
  130. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  131. .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  132. );
  133. layout.setVerticalGroup(
  134. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  135. .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  136. );
  137.  
  138. pack();
  139. }// </editor-fold>
  140.  
  141. private void Username1ActionPerformed(java.awt.event.ActionEvent evt) {
  142. // TODO add your handling code here:
  143. }
  144.  
  145. private void CancelbtnActionPerformed(java.awt.event.ActionEvent evt) {
  146. // This exits the program
  147. System.exit(0);
  148. }
  149.  
  150. private void LoginbtnActionPerformed(java.awt.event.ActionEvent evt) {
  151. // TODO add your handling code here:
  152. String password = Password1.getText();
  153. String username = Username1.getText();
  154.  
  155. if(password.contains("admin")&& username.contains ("admin"))
  156. Password1.setText("");
  157. Username1.setText("");
  158.  
  159.  
  160.  
  161. }
  162.  
  163.  
  164. private void Password1ActionPerformed(java.awt.event.ActionEvent evt) {
  165.  
  166.  
  167. }
  168.  
  169. /**
  170. * @param args the command line arguments
  171. */
  172. public static void main(String args[]) {
  173. /* Set the Nimbus look and feel */
  174. //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  175. /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  176. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  177. */
  178. try {
  179. for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  180. if ("Nimbus".equals(info.getName())) {
  181. javax.swing.UIManager.setLookAndFeel(info.getClassName());
  182. break;
  183. }
  184. }
  185. } catch (ClassNotFoundException ex) {
  186. java.util.logging.Logger.getLogger(LoginPageUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  187. } catch (InstantiationException ex) {
  188. java.util.logging.Logger.getLogger(LoginPageUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  189. } catch (IllegalAccessException ex) {
  190. java.util.logging.Logger.getLogger(LoginPageUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  191. } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  192. java.util.logging.Logger.getLogger(LoginPageUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  193. }
  194. //</editor-fold>
  195.  
  196. /* Create and display the form */
  197. java.awt.EventQueue.invokeLater(new Runnable() {
  198. public void run() {
  199. new LoginPageUI().setVisible(true);
  200. }
  201. });
  202. }
  203.  
  204. // Variables declaration - do not modify
  205. private javax.swing.JToggleButton Cancelbtn;
  206. private javax.swing.JToggleButton Loginbtn;
  207. private javax.swing.JPasswordField Password1;
  208. private javax.swing.JTextField Username1;
  209. private javax.swing.JLabel jLabel1;
  210. private javax.swing.JLabel jLabel2;
  211. private javax.swing.JLabel jLabel4;
  212. private javax.swing.JPanel jPanel1;
  213. // End of variables declaration
  214. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement