You should use thread anyway, not only for getting the keyRelease event, if you want a smooth animation.

The key latching behavior that you want could be implemented using one int mask (using...