bayern.steinbrecher.screens.ScreenController Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ScreenSwitcher Show documentation
Show all versions of ScreenSwitcher Show documentation
An abstract structure for JavaFX based applications for handling dialogs and switching between them.
package bayern.steinbrecher.screens;
import javafx.fxml.FXML;
import org.jetbrains.annotations.NotNull;
public abstract class ScreenController {
private ScreenManager screenManager;
@NotNull
protected ScreenManager getScreenManager() {
if(screenManager == null){
throw new IllegalStateException("There is no screen manager attached");
} else {
return screenManager;
}
}
void setScreenManager(@NotNull ScreenManager screenManager) {
this.screenManager = screenManager;
}
@FXML
protected void switchToPreviousScreen(){
getScreenManager().switchBack();
}
}