package controller; import model.*; import view.*; import java.awt.*; /** * The controller that instantiates and connects the HangmanGame (the model) * and the HangmanFrame (the view) via adapters. * The adapters are implemented as anonymous inner classes. * @stereotype Controller */ public class HangmanController { /** * Instantiates the HangmanGame, HangmanFrame, and connects them together * using anonymous inner class defined adapters. * In this simplified version, there is no game playing, so there is no * need for loose and/or win adapters. */ public void constructGame() { final HangmanFrame frame = new HangmanFrame(); final HangmanGame hangmanGame = new HangmanGame(); frame.addAdapters( new IPaintAdapter() { public void paint(Graphics g) { hangmanGame.paint(g); } }); frame.setVisible(true); } }