Define a String field to hold the keystrokes. Initialize its value to an empty string and reset it to an empty string anytime the order is tested and found incorrect. Each time a key is pressed, add that character to the string. You will have to decide when to check the concatenated string for the proper sequence and when to clear its value.