Slick2D Problem with state

As you can see below in the code I’m overriding enter method, to make sure that everything is reset before I join the state again.
Let me take you quickly through. So you enter the Settings State, you make some changes, dialog pops up with a message “Do you want to save the game settings?”,
with 3 options (YES, NO, CANCEL). You press NO, and it takes you to the Game Menu State. You come back to the settings, and BOOM, settings did not reset.


public class SettingsScreenState extends PAbstractState {
    
    public static final int ID = 5;

    private Image titleImage;
    private PButton backButton;
    private PDialog dialog;

    private boolean saveSettingsDialog;
    
    private SettingsScreenUI settingsScreenUI;
    
    public SettingsScreenState() {}
    
    @Override
    public int getID() {
        return ID;
    }

    @Override
    public void enter(GameContainer gc, StateBasedGame sg) throws SlickException {
        settingsScreenUI = new SettingsScreenUI();
        settingsScreenUI.init(gc);
    }
    
    @Override
    public void init(GameContainer gc, StateBasedGame sg) throws SlickException {
        titleImage = new Image("res/gui/titleSettings.png");
        
        backButton = new PButton("buttonBack");
        dialog = new PDialog();
    }

    @Override
    public void render(GameContainer gc, StateBasedGame sg, Graphics g) throws SlickException {
        PTheme.bgTheme(gc, g);
        
        float titleX = 50;
        float titleY = 50;
        titleImage.draw(titleX, titleY);
        
        float backButtonX = gc.getWidth() / 2 - backButton.getWidth() / 2;
        float backButtonY = gc.getHeight() - backButton.getHeight() - 30;
        backButton.render(g, backButtonX, backButtonY);
        
        settingsScreenUI.render(gc, g);     

        if (saveSettingsDialog) {
            String title = "Information";
            String text = "Some of your settings will not take effect until you restart the game.\n\n"
                        + "Do you want to save the game settings?";
            dialog.showConfirmDialog(gc, g, title, text);
        }
    }

    @Override
    public void update(GameContainer gc, StateBasedGame sg, int delta) throws SlickException {
        Input input = gc.getInput();
        int mx = input.getMouseX();
        int my = input.getMouseY();
        
        System.out.println("\nMessage dialog: " + dialog.getDialogResponse());
        System.out.println("Panel has focus: " + this.hasFocus);
        System.out.println("Start settings: " + Settings.getStartSettings());
        System.out.println("Current settings: " + settingsScreenUI.getCurrentSettings());
        System.out.println("Settings have been changed: " + settingsScreenUI.haveSettingsChanged());
        
        if (saveSettingsDialog) {        
            switch (dialog.getDialogResponse()) {
                case YES:
                    Settings.save();
                    saveSettingsDialog = false;
                    dialog.performAction(this);
                    sg.enterState(StartScreenState.ID, new FadeOutTransition(), new FadeInTransition());
                    break;
                case NO:
                    saveSettingsDialog = false;
                    dialog.performAction(this);
                    sg.enterState(StartScreenState.ID, new FadeOutTransition(), new FadeInTransition());
                    break;
                case CANCEL:
                    saveSettingsDialog = false;
                    dialog.performAction(this);
                    break;
            }
        }
        
        if (!this.hasFocus) return;
        
        if (backButton.isActionPerformed(input, mx, my)) {
            if (settingsScreenUI.haveSettingsChanged()) {
                saveSettingsDialog = true;
                dialog.performAction(this);
            } else {
                sg.enterState(StartScreenState.ID, new FadeOutTransition(), new FadeInTransition());
            }
        }
        settingsScreenUI.update(gc, sg, delta);
    }

}

Below are the methods which are part of the SettingsScreenUI:


public List getCurrentSettings() {
        List currentSettings = new ArrayList(Settings.getStartSettings().size());
        
        currentSettings.add(Settings.video.getWidth());
        currentSettings.add(Settings.video.getHeight());
        currentSettings.add(Settings.video.isFullScreen());
        currentSettings.add(Settings.video.isFps());
        currentSettings.add(Settings.sound.isSound());
        currentSettings.add(Settings.sound.getVolume());
        
        return currentSettings;
    }
    
    public boolean haveSettingsChanged() {
        for (int i = 0; i < Math.max(Settings.getStartSettings().size(), getCurrentSettings().size()); i++) {
            if (!Settings.getStartSettings().get(i).equals(getCurrentSettings().get(i))) {
                return true;
            }
        }
        return false;
    }