Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

username and password

843807Jun 7 2010 — edited Jun 8 2010
ok so far ive got the password working

public void actionPerformed( ActionEvent evt)
*{*

String cmd = evt.getActionCommand();

if (password.equals(cmd)&& name.equals(cmd))
*{ //Process the password.*
char[] input = menupasswordtext.getPassword();
if (isPasswordCorrect(input))
*{*
options();
menuframe.setVisible(false);
*}*
*else {*
JOptionPane.showMessageDialog(menuframe,
*"Invalid password. Try again.",*
*"Error Message",*
JOptionPane.ERROR_MESSAGE);
*}*
*}*
*}*
*private static boolean isPasswordCorrect(char[] input) {*
boolean isCorrect = true;
*char[] correctPassword = { 'p', 'a', 's', 's', 'w', 'o', 'r','d' };*
*if (input.length != correctPassword.length) {*
isCorrect = false;
*} else {*
isCorrect = Arrays.equals (input, correctPassword);
*}*

*//Zero out the password.*
Arrays.fill(correctPassword,'0');

return isCorrect;
*}*


but im trying now to put together a username with that password but i dont know how to. im using a textfield for the username just trying to put that together with the passwordfield.

any ideas?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 6 2010
Added on Jun 7 2010
1 comment
496 views