This question already has an answer here:
- How do I compare strings in Java? 23 answers
So, I'm trying to do something really simple, and that's check if a password equals something in my SWT application. So, my code was this:
if (passwordBox.getText() == "test") {
passwordBox.setVisible(false);
}
However, in my application, which uses text fields marked as passwords (with that variable), it will not fire that when I click a button. I already have button handling working, since I have an else
statement that fires, but this will not fire when the password box obviously equals "test". What's wrong here?
Aucun commentaire:
Enregistrer un commentaire