dbrown
Class TextView

java.lang.Object
  extended by dbrown.TextView

public class TextView
extends java.lang.Object

A simple text interface to the Hangman game. This illustrates how a model (in this case the Hangman game) can be viewed by different interfaces. This is a text-only view of the model, whereas other views are GUI based.

Version:
2011-11-11
Author:
David Brown

Nested Class Summary
private  class TextView.GameListener
          Is called by the Hangman model to display the current state of the model when the model is started and whenever a guess is made.
private  class TextView.LoseListener
          Displays a message when the game is lost.
private  class TextView.WinListener
          Displays a message when the game is won.
 
Field Summary
private  Hangman model
          The Hangman game object.
 
Constructor Summary
TextView(Hangman model)
           
 
Method Summary
 void play()
          Play the Hangman game by instantiating the game and asking the user for input.
private  void registerListeners()
          Registers model property listeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

private Hangman model
The Hangman game object.

Constructor Detail

TextView

public TextView(Hangman model)
Parameters:
model -
Method Detail

play

public void play()
Play the Hangman game by instantiating the game and asking the user for input. Allows only a single game to be played per run.


registerListeners

private void registerListeners()
Registers model property listeners.