What is the screen object in your code:

screen.println("....");

Your general idea can work, except you won't want to use == to compare Strings since == tests to see if two String *objects* (or...