Add key handling in swing terminal