JOptionPane
Hi.
I am having a problem with my program. I am trying to create a logon
usint the JOptionPane, however, it will not correctly compare my
inputs.
Any ideas.
Cheers.
//here follows some code which serves no useful purpose
import javax.swing.JOptionPane;
public class hacking {
public static void main( String args[] ){
String username, coreuser="admin";
String passcode;
String domain, coredom="Google";
int passcodeint, corepass=10179264;
Boolean user=false,pass=false,dom=false;
username = JOptionPane.showInputDialog( "Enter UserName" );
passcode = JOptionPane.showInputDialog( "Enter PassCode" );
domain = JOptionPane.showInputDialog( "Enter Domain" );
passcodeint = Integer.parseInt( passcode );
if( username == coreuser ) user = true;
if( passcodeint == corepass ) pass = true;
if( domain == coredom ) dom = true;
//here follows a debug line
JOptionPane.showMessageDialog( null, user+" "+pass+" "+dom,
"Booleans", JOptionPane.PLAIN_MESSAGE );
if( user == true & pass == true & dom == true ){
JOptionPane.showMessageDialog( null,"Access Granted"
,"Login Successful" ,JOptionPane.PLAIN_MESSAGE );
} else {
JOptionPane.showMessageDialog( null,"Access Denied" ,"Login
Unsuccessful" ,JOptionPane.PLAIN_MESSAGE );
}
}
}