CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Threaded View

  1. #1
    Join Date
    Feb 2010
    Posts
    121

    can someone help me with this if statement

    I am truly stuck with getting the following if statement to work
    Code:
          AnagramButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            //if (model.getSize() > 0)
                if(AnagramLetters.equals(null)) {
                findWordThread = new FindWordThread();
                return;
            }else
            {
                AnagramLetters.setText(getCurrentRack().toString());
                findWordThread = new FindWordThread();
                return;
           }
            }
    Here's what I would like it to do. If a player clicks the anagram button, and only if the AnagramLetters field is left blank, the code should take letters from the players rack to work out anagrams - thankfully this part works!!

    However, my problem is, and this is where I am stuck, if a player types letters into the the AnagramLetters field the code should work out anagrams based on these 'typed' letters but the code always overwrites the 'typed' letters with the players rack, which I don't want to happen.

    I know this seems fairly simple logic but I cannot get my head around it and I have tried many variations from 'is not null' to 'is null' to 'equals null' with no luck, in fact, it always does the opposite?

    Any thoughts?
    Last edited by peahead; March 28th, 2010 at 03:24 AM. Reason: typo - reads better

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured