private void initializeScene() {

        final Stage currentStage = this.stage;

        final KeyCode fullKeyCode = fullScreenKeyCode();
        final KeyCode iconKeyCode = iconifiedKeyCode();

        // Attach the handler only if necessary, these 2 method can be overridden to return null
        if (fullKeyCode != null && iconKeyCode != null) {

            this.scene.addEventFilter(KeyEvent.KEY_PRESSED, keyEvent -> {

                // Manage F11 button to switch full screen
                if (fullKeyCode != null && fullKeyCode == keyEvent.getCode()) {
                    currentStage.setFullScreen(!currentStage.isFullScreen());
                    keyEvent.consume();
                    // Manage F10 button to iconify
                } else if (iconKeyCode != null && iconKeyCode == keyEvent.getCode()) {
                    currentStage.setIconified(!currentStage.isIconified());
                    keyEvent.consume();
                }

            });
        }

        // The call customize method to allow extension by sub class
        customizeScene(this.scene);

        // Add the default Style Sheet if none have been added
        manageDefaultStyleSheet(this.scene);

    }
private void initializeScene ( ) { final Stage currentStage = this . stage ; final KeyCode fullKeyCode = fullScreenKeyCode ( ) ; final KeyCode iconKeyCode = iconifiedKeyCode ( ) ; if ( fullKeyCode != null && iconKeyCode != null ) { this . scene . addEventFilter ( KeyEvent . KEY_PRESSED , keyEvent -> { if ( fullKeyCode != null && fullKeyCode == keyEvent . getCode ( ) ) { currentStage . setFullScreen ( ! currentStage . isFullScreen ( ) ) ; keyEvent . consume ( ) ; } else if ( iconKeyCode != null && iconKeyCode == keyEvent . getCode ( ) ) { currentStage . setIconified ( ! currentStage . isIconified ( ) ) ; keyEvent . consume ( ) ; } } ) ; } customizeScene ( this . scene ) ; manageDefaultStyleSheet ( this . scene ) ; }
Initialize the default scene.