username and password
843807Jun 7 2010 — edited Jun 8 2010ok 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?