Advertisement
Guest User

Untitled

a guest
Mar 18th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. JTextField username = new JTextField();
  2. JTextField password = new JPasswordField();
  3. Object[] message = {
  4.     "Username:", username,
  5.     "Password:", password
  6. };
  7.  
  8. int option = JOptionPane.showConfirmDialog(null, message, "Login", JOptionPane.OK_CANCEL_OPTION);
  9. if (option == JOptionPane.OK_OPTION) {
  10.     if (username.getText().equals("h") && password.getText().equals("h")) {
  11.         System.out.println("Login successful");
  12.     } else {
  13.         System.out.println("login failed");
  14.     }
  15. } else {
  16.     System.out.println("Login canceled");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement