[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using getText() with a JTextField component?


I am using the getText() JTextComponent method to retrieve a string form a
JTextField component.  The problem that I am getting is the string is
returned back, but it does pass a comparsion check when I compared it to
another string:

//ie lets say the string entered in the text field is "Mike"
String sName = m_nameTF.getText().trim();

//The following line works - prints "Mike

//This condition fails
if (sName == "Mike")

Any suggestions?