JAMSHAID
JAMSHAID

Reputation: 1357

Compare two JTextFields

I am trying this one but it gives an error.

if(jTextField1.getText().equals("1") && jTextField2.getText().compareToIgnoreCase("1")!))

please suggest me how can i compare both text fields to check the condition if(1st not equals to 2nd). Thanks!

Upvotes: 1

Views: 140

Answers (1)

bit-shashank
bit-shashank

Reputation: 921

if(jTextField1.getText().equals(jTextField2.getText()))
{
//both text fields have same text
}

else
{
// both text fields have different text

}

Upvotes: 2

Related Questions