public void stateChanged() {
    Component component = null;
    State state = stateMachine.currentState();
    if (state instanceof LoadState) {
      component = new LoadStatePanel((LoadState)stateMachine.currentState());
    }
    else if (state instanceof MenuState) {
      component = new MenuStatePanel((MenuState)stateMachine.currentState());
    }
    else if (state instanceof EditState) {
      component = new EditStatePanel((EditState)stateMachine.currentState());
    }
    else if (state instanceof EvalState) {
      component = new EvalStatePanel((EvalState)stateMachine.currentState());
    }
    else if (state instanceof GameState) {
      component = new GameStatePanel((GameState)stateMachine.currentState());
    }
    else if (state instanceof ResultState) {
      component = new ResultStatePanel((ResultState)stateMachine.currentState());
    }
    else if (state instanceof AboutState) {
      component = new AboutStatePanel((AboutState)stateMachine.currentState());
    }
    else if (state instanceof ContactState) {
      component = new ContactStatePanel((ContactState)stateMachine.currentState());
    }
    else {
      Error.out("State not supported: " + state);
    }
    
    // and fade in the new component
    fadeIn(component);
  }