Advertisement
Guest User

asd

a guest
Oct 18th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.awt.event.*;
  3. public class LogInForm implements ActionListener{
  4. private JFrame jfLogIn;
  5. private JLabel jlUser, jlPass;
  6. private JTextField jtfUser;
  7. private JPasswordField jpPass;
  8. private JButton jbOk, jbCancel;
  9. public LogInForm(){
  10. jfLogIn = new JFrame("Log In");
  11. jlUser = new JLabel("Username: ");
  12. jlPass = new JLabel("Password: ");
  13. jtfUser = new JTextField();
  14. jpPass = new JPasswordField();
  15. jbOk = new JButton("Ok");
  16. jbCancel = new JButton("Cancel");
  17. }
  18. public void launch(){
  19. jfLogIn.setLayout(null);
  20. jfLogIn.setBounds(160, 150, 400, 300);
  21. jfLogIn.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  22. jlUser.setBounds(30, 50, 150, 30);
  23. jfLogIn.add(jlUser);
  24. jlPass.setBounds(30, 100, 100, 30);
  25. jfLogIn.add(jlPass);
  26. jtfUser.setBounds(150, 50, 200, 30);
  27. jfLogIn.add(jtfUser);
  28. jpPass.setBounds(150, 100, 200, 30);
  29. jfLogIn.add(jpPass);
  30. jbOk.setBounds(60, 160, 100, 30);
  31. jbOk.addActionListener(this);
  32. jfLogIn.add(jbOk);
  33. jbCancel.setBounds(200, 160, 100, 30);
  34. jbCancel.addActionListener(this);
  35. jfLogIn.add(jbCancel);
  36. jfLogIn.setVisible(true);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement