I'm trying to us an if-else statement to check if they typed something specific in the TextField but it will never return true. How do I get this to work or is there a work around?
String text = textField.getText();
if(text == "work"){
textArea.append("Text was " + text + newline);
textArea.append("If you see this then it worked");
}else{
textArea.append(text + newline);
}
This will display "work" for me.
For convenient purposeses I used the oracle tutorial to test this to see if my JTextField http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/uiswing/examples/components/TextDemoProject/src/components/TextDemo.java