Testing a password
Posted by hallockk on Apr 06, 2010; 7:01pm
URL: http://imagej.273.s1.nabble.com/Testing-a-password-tp3688636.html
Hi everyone,
I'm trying to develop some code to allow the user to type in a string password and then test the string. I wrote the following:
GenericDialog GetPassword = new GenericDialog("Password");
GetPassword.addStringField(" Password: ", "password");
GetPassword.showDialog();
String ToPass = GetPassword.getNextString();
//Message for troubleshooting purposes
int TestToPass = 0;
if (ToPass == "password"){
TestToPass = 1;
}
IJ.showMessage("Password",ToPass);
String StrTestToPass = Integer.toString(TestToPass);
IJ.showMessage("TestToPass",Integer.toString(TestToPass));
Below this troubleshooting code I have the additional actions, but what's become clear is that whatever string is part of the dialog isn't being tested properly by the IF statement. If I make a string that equals "password" within the code, the IF statement triggers fine, but not when "password" is acquired from the getNextString() function.
Thanks,
Kevin Hallock