so just switch from MouseEvent to KeyEvent and it should all work.
event.getEventType() == MouseEvent.MOUSE_DRAGGED
Your KeyEvents are
getCode public final KeyCode getCode() The key code associated with the key in this key pressed or key released event. For key typed events, code is always KeyCode.UNDEFINED. Returns: The key code associated with the key in this event, KeyCode.UNDEFINED for key typed event
The important getEventType() is inherited from Event http://docs.oracle.com/javafx/2/api/javafx/event/Event.html#getEventType()
Field Summary Fields Modifier and Type Field and Description static EventType<KeyEvent> ANY Common supertype for all key event types. static java.lang.String CHAR_UNDEFINED KEY_PRESSED and KEY_RELEASED events which do not map to a valid Unicode character use this for the keyChar value. static EventType<KeyEvent> KEY_PRESSED This event occurs when a key has been pressed. static EventType<KeyEvent> KEY_RELEASED This event occurs when a key has been released. static EventType<KeyEvent> KEY_TYPED This event occurs when a key has been typed (pressed and released).
getEventType public EventType<? extends Event> getEventType() Gets the event type of this event. Objects of the same Event class can have different event types. These event types further specify what kind of event occurred. Returns: the event type