Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JTextField username = new JTextField();
- JTextField password = new JPasswordField();
- Object[] message = {
- "Username:", username,
- "Password:", password
- };
- int option = JOptionPane.showConfirmDialog(null, message, "Login", JOptionPane.OK_CANCEL_OPTION);
- if (option == JOptionPane.OK_OPTION) {
- if (username.getText().equals("h") && password.getText().equals("h")) {
- System.out.println("Login successful");
- } else {
- System.out.println("login failed");
- }
- } else {
- System.out.println("Login canceled");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement