Code example for PasswordAuthentication

0
         
        if (option == JOptionPane.OK_OPTION) {
            String user = username.getText();
            char   pass[] = password.getText().toCharArray();
             
            return new PasswordAuthentication(user, pass);
        } 
        return null; 
    } 
 
} 
Contextual code suggestions in your IDE  Get Codota for Java