Advertisement
Guest User

Untitled

a guest
May 20th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. private JTextField paf;
  2.  
  3. /**
  4. * Launch the application.
  5. */
  6. public static void main(String[] args) {
  7. EventQueue.invokeLater(new Runnable() {
  8. public void run() {
  9. try {
  10. GG frame = new GG();
  11. frame.setVisible(true);
  12. } catch (Exception e) {
  13. e.printStackTrace();
  14. }
  15. }
  16. });
  17. }
  18.  
  19. /**
  20. * Create the frame.
  21. */
  22. public GG() {
  23. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  24. setBounds(100, 100, 650, 500);
  25. contentPane = new JPanel();
  26. contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  27. contentPane.setLayout(new BorderLayout(0, 0));
  28. setContentPane(contentPane);
  29.  
  30. JPanel panel = new JPanel();
  31. contentPane.add(panel, BorderLayout.CENTER);
  32. panel.setLayout(null);
  33.  
  34. JPanel panel_1 = new JPanel();
  35. panel_1.setBackground(SystemColor.textHighlight);
  36. panel_1.setBounds(0, 0, 624, 67);
  37. panel.add(panel_1);
  38. panel_1.setLayout(null);
  39.  
  40. JLabel lblNewLabel = new JLabel("Login");
  41. lblNewLabel.setForeground(SystemColor.text);
  42. lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 30));
  43. lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
  44. lblNewLabel.setBounds(183, 5, 250, 51);
  45. panel_1.add(lblNewLabel);
  46.  
  47. usf = new JTextField();
  48. usf.setFont(new Font("Tahoma", Font.PLAIN, 13));
  49. usf.setBounds(225, 150, 173, 29);
  50. panel.add(usf);
  51. usf.setColumns(10);
  52.  
  53. paf = new JTextField();
  54. paf.setFont(new Font("Tahoma", Font.PLAIN, 13));
  55. paf.setColumns(10);
  56. paf.setBounds(225, 190, 173, 29);
  57. panel.add(paf);
  58.  
  59. JLabel lblNewLabel_1 = new JLabel("Username:");
  60. lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 15));
  61. lblNewLabel_1.setBounds(126, 150, 89, 29);
  62. panel.add(lblNewLabel_1);
  63.  
  64. JLabel lblPassword = new JLabel("Password:");
  65. lblPassword.setFont(new Font("Tahoma", Font.PLAIN, 15));
  66. lblPassword.setBounds(126, 190, 89, 29);
  67. panel.add(lblPassword);
  68.  
  69. JButton Login = new JButton("Login");
  70. Login.addActionListener(new ActionListener() {
  71. public void actionPerformed(ActionEvent arg0) {
  72.  
  73.  
  74. for(int counter = 0;counter<G.username.length;counter++) {
  75.  
  76.  
  77. if(G.username[counter].equals(usf.getText())&&G.password[counter].equals(paf.getText())) {
  78.  
  79.  
  80. System.out.println("good");
  81.  
  82. }
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91. }
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99. }
  100. });
  101. Login.setBounds(380, 280, 89, 23);
  102. panel.add(Login);
  103.  
  104. JButton Registr = new JButton("Register");
  105. Registr.addActionListener(new ActionListener() {
  106. public void actionPerformed(ActionEvent e) {
  107.  
  108. R r = new R();
  109. r.setVisible(true);
  110.  
  111.  
  112.  
  113. }
  114. });
  115. Registr.setBounds(265, 280, 89, 23);
  116. panel.add(Registr);
  117. }
  118. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement