| | |
| | /** |
| | + * Creates an instance of {@link KeyEvent} that represents a key released |
| | + * event without any modifier keys held. |
| | + * |
| | + * @param code The key code representing a key to simulate releasing. |
| | + * @return An instance of {@link KeyEvent}. |
| | + */ |
| | + public static Event keyDown( final KeyCode code ) { |
| | + return keyDown( code, false ); |
| | + } |
| | + |
| | + /** |
| | * Creates an instance of {@link KeyEvent} that represents releasing a key. |
| | * |
| | * @param code The key to simulate being released up. |
| | * @param shift Whether shift key modifier shall modify the key code. |
| | * @return An instance of {@link KeyEvent} that may be used to simulate |
| | * a key being released. |
| | */ |
| | + @SuppressWarnings( "unused" ) |
| | public static Event keyUp( final KeyCode code, final boolean shift ) { |
| | return keyEvent( KEY_RELEASED, code, shift ); |
| | - } |
| | - |
| | - /** |
| | - * Creates an instance of {@link KeyEvent} that represents a key released |
| | - * event without any modifier keys held. |
| | - * |
| | - * @param code The key code representing a key to simulate releasing. |
| | - * @return An instance of {@link KeyEvent}. |
| | - */ |
| | - public static Event keyUp( final KeyCode code ) { |
| | - return keyUp( code, false ); |
| | } |
| | |
 |
| | stage.focusedProperty().addListener( ( c, lost, found ) -> { |
| | if( found ) { |
| | - mMainScene.getMenuBar().fireEvent( keyDown( ESCAPE, false ) ); |
| | + mMainScene.getMenuBar().fireEvent( keyDown( ESCAPE ) ); |
| | } |
| | } ); |