private void windowedMode() {
        boolean isFullscreen = settings.isFullscreen();
        if (!isFullscreen) {
            System.out.println("Request ignored: already in windowed mode!");
            return;
        }

        System.out.println("fullscreen = " + false);
        settings.setFullscreen(false);
        settings.setWidth(640);
        settings.setHeight(480);
        setSettings(settings);

        restart();
    }
If the app is in fullscreen mode, restart it in 640x480 windowed mode.
jme3-examples/src/main/java/jme3test/renderer/TestIssue798.java