uk.co.caprica.vlcj.javafx.fullscreen.JavaFXFullScreenStrategy Maven / Gradle / Ivy
/*
* This file is part of VLCJ.
*
* VLCJ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VLCJ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VLCJ. If not, see .
*
* Copyright 2009-2022 Caprica Software Limited.
*/
package uk.co.caprica.vlcj.javafx.fullscreen;
import javafx.stage.Stage;
import uk.co.caprica.vlcj.player.embedded.fullscreen.FullScreenStrategy;
/**
* Implementation of a full-screen strategy for JavaFX.
*
* This is a cross-platform strategy.
*/
public class JavaFXFullScreenStrategy implements FullScreenStrategy {
/**
* Stage to switch to full screen.
*/
private final Stage stage;
/**
* Create a full-screen strategy
*
* @param stage stage to switch to full screen
*/
public JavaFXFullScreenStrategy(Stage stage) {
this.stage = stage;
}
@Override
public final void enterFullScreenMode() {
onBeforeEnterFullScreen();
stage.setFullScreen(true);
}
@Override
public final void exitFullScreenMode() {
stage.setFullScreen(false);
onAfterExitFullScreen();
}
@Override
public final boolean isFullScreenMode() {
return stage.isFullScreen();
}
/**
* Optional override to perform operations before switching to full screen.
*/
public void onBeforeEnterFullScreen() {
}
/**
* Optional override to perform operations after switching back from full screen.
*/
public void onAfterExitFullScreen() {
}
}