This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GetText problem in a GUI

 
garfild Baram
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a very very strange problem.
I created a GUI that contains a text box text1.
In my code I have the following line:
String LabelId = text1.getText().trim();
If (LabelId == null)
{
......
}
I didn't initialized text1 so i expected to enter the If statement but it didn't.
even
If (LabelId == "")
{
......
}
dosent put me inside the If!
What did I miss???
Please advise
garfild
 
Amol Desai
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Try using
if (LabelId.equals(""))
{
......
}
Get back in case of any problems
 
garfild Baram
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works as needed.
Thanks Amol
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic