Guest User

Untitled

a guest
Nov 6th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. import java.awt.EventQueue;
  2.  
  3. import javax.swing.JFrame;
  4. import javax.swing.JButton;
  5. import javax.swing.JToolBar;
  6. import javax.swing.JTextField;
  7. import javax.swing.JLabel;
  8. import javax.swing.JSeparator;
  9. import javax.swing.JTable;
  10. import java.awt.event.ActionListener;
  11. import java.awt.event.ActionEvent;
  12. import java.util.Scanner;
  13.  
  14.  
  15. public class system {
  16.  
  17. protected static final int Admin = 0;
  18. private JFrame frame;
  19. private JTextField Usernameinput;
  20. private JTextField Passwordinput;
  21.  
  22. /**
  23. * Launch the application.
  24. */
  25. public static void main(String[] args) {
  26. EventQueue.invokeLater(new Runnable() {
  27. Scanner input = new Scanner(System.in);
  28. public void run() {
  29. try {
  30. system window = new system();
  31. window.frame.setVisible(true);
  32. } catch (Exception e) {
  33. e.printStackTrace();
  34. }
  35. }
  36. });
  37. }
  38.  
  39. /**
  40. * Create the application.
  41. */
  42. public system() {
  43. initialize();
  44. }
  45.  
  46. /**
  47. * Initialize the contents of the frame.
  48. */
  49. private void initialize() {
  50. frame = new JFrame();
  51. frame.setBounds(100, 100, 534, 365);
  52. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  53. frame.getContentPane().setLayout(null);
  54.  
  55. JButton btnLogin = new JButton("Login");
  56. btnLogin.addActionListener(new ActionListener() {
  57. public void actionPerformed(ActionEvent e) {
  58.  
  59. String username;
  60. String password;
  61.  
  62. System.out.println("Log in:");
  63. System.out.println("username: ");
  64. Scanner input = null;
  65. username = input.next();
  66.  
  67. System.out.println("password: ");
  68. password = input.next();
  69.  
  70. //users check = new users(username, password);
  71.  
  72. if(Usernameinput.equals(Admin) && Passwordinput.equals(Admin))
  73. System.out.println("Welcome");;
  74.  
  75.  
  76.  
  77. }
  78. });
  79. btnLogin.setBounds(29, 242, 89, 23);
  80. frame.getContentPane().add(btnLogin);
  81.  
  82. JButton btnReset = new JButton("Reset");
  83. btnReset.setBounds(144, 242, 89, 23);
  84. frame.getContentPane().add(btnReset);
  85.  
  86. JButton btnExit = new JButton("Exit");
  87. btnExit.addActionListener(new ActionListener() {
  88. public void actionPerformed(ActionEvent arg0) {
  89. System.exit(0);
  90. }
  91. });
  92. btnExit.setBounds(397, 282, 89, 23);
  93. frame.getContentPane().add(btnExit);
  94.  
  95. Usernameinput = new JTextField();
  96. Usernameinput.setBounds(144, 74, 209, 20);
  97. frame.getContentPane().add(Usernameinput);
  98. Usernameinput.setColumns(10);
  99.  
  100.  
  101. Passwordinput = new JTextField();
  102. Passwordinput.setColumns(10);
  103. Passwordinput.setBounds(144, 106, 209, 20);
  104. frame.getContentPane().add(Passwordinput);
  105.  
  106. JLabel lblUsername = new JLabel("Username:");
  107. lblUsername.setBounds(73, 77, 55, 14);
  108. frame.getContentPane().add(lblUsername);
  109.  
  110. JLabel lblPassword = new JLabel("Password:");
  111. lblPassword.setBounds(73, 108, 55, 17);
  112. frame.getContentPane().add(lblPassword);
  113.  
  114. JSeparator separator = new JSeparator();
  115. separator.setBounds(10, 211, 498, 2);
  116. frame.getContentPane().add(separator);
  117.  
  118. JSeparator separator_1 = new JSeparator();
  119. separator_1.setBounds(10, 57, 498, 2);
  120. frame.getContentPane().add(separator_1);
  121.  
  122. JLabel lblNewLabel = new JLabel("Welcome to The System v 0.1");
  123. lblNewLabel.setBounds(182, 5, 151, 41);
  124. frame.getContentPane().add(lblNewLabel);
  125. }
  126. }
Add Comment
Please, Sign In to add comment