Implementing Multiple Screens

So, before I explain how to do this, ask yourself a question:

Why the F do I need Multiple Screens?!??

This is JME! That’s what AppStates are for.

Now… on with the example of how to implement multiple screens using AppStates.

public class UserLogin extends AbstractAppState {
    Main app;
    Screen screen;

    LoginBox loginWindow;

    public UserLogin(Main app, Screen screen) { = app;
        this.screen = screen;

    public void initialize(AppStateManager stateManager, Application app) {
        super.initialize(stateManager, app);


    public void initLoginWindow() {
        loginWindow = new LoginBox(screen,
                new Vector2f(screen.getWidth()/2-175,screen.getHeight()/2-125)) {
            public void onButtonLoginPressed(MouseButtonEvent evt, boolean toggled) {
                // Some call to the server to log the client in

    public void cleanup() {


    public void finalizeUserLogin() {
        // Some call to your app to unload this AppState and load the next AppState

And Ker-pow! You have a screen without a new Screen.

If you want to be fancy about loading and unloading the contents of the screen, use the EffectManager and call the following when running the effects from the cleanup() method of the AppState.