Skip to content

Programm, for javaFX, to change and manage scenes easily

Notifications You must be signed in to change notification settings

FTMahringer/SceneManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SceneManager

This is the release of my Library SceneManager and CustomAlerts.

It is for managing fxmls in the Scenes Enum and showing and changing those Scenes.

You need to implement the code for it to function properly. In the enum, please put your own scenes infos.

Authors

Features

  • Managing Scenes in a enum class.
  • Switching scenes on the go.
  • Creating popup windows, that prevent the closing of the "actual" window.
  • Going back to the previous window
  • Getting Alerts running and showing easier

Usage/Examples

Tu use the SceneManager, you need to create two classes:

SceneManager.java and Scenes.java

Please see the SceneManager and Scenes.java files, and copy everything inside into the created file.

To start using it, please use like this:

public class Starter extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {
        SceneManager.getInstance().showScene(Scenes.MAIN_MENU);
    }
}

Test if scene/popup is open

To test, which scene or popup, is open Or to test if the desired scene/popup is open, use:

if (getSceneStack().peek().equals(Scenes.GAME) && popUpSceneStack.peek().equals(Scenes.ESCMENU)) {
            GameController.resume();
}

This is just for example, to show that soemthing like this would be possible.



The CustomAlerts, are rather intutive and don't really need an explanation.

In the Scenes class, each scene is managed like this:

    MAIN_MENU("hello-view.fxml", "Menu")

The Scenes class is an enum class, that just holds all the used scenes, that are openable windows.

The path to the fxmls starts from the ressource folder of the project

Please tell me if i should add more functionalities to this small helper Programm.

About

Programm, for javaFX, to change and manage scenes easily

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages