Interface HangmanUI

All Superinterfaces:
java.util.Observer
All Known Implementing Classes:
SimpleUI, SwingUI

public interface HangmanUI
extends java.util.Observer

HangmanUI is a Java Interface that describes the behavior of a user interface for the solitaire Hangman game. The user interface allows the player to guess letters and displays the correctly guessed letters.

Version:
1.0
Author:
J. Dalbey

Method Summary
 void playAgain()
          Handle end of game, asking if the player wants another game If yes, start a new game, otherwise exit.
 void setControl(Controller control)
          Set reference to the controller that handles our input.
 void setVisible(boolean visible)
          Start the display.
 void showLose(java.lang.String message)
          Display that the player lost the game.
 void showWin()
          Display that the player won the game.
 void update(java.util.Observable obs, java.lang.Object obj)
          Update the ui when notified by the game.
 

Method Detail

setControl

void setControl(Controller control)
Set reference to the controller that handles our input.

Parameters:
control - reference to the Controller who responds to actions on this UI

setVisible

void setVisible(boolean visible)
Start the display. For event-driven interfaces this method simply makes the interface visible. For sequential (e.g. console-based) interfaces, this method must implement its own event loop.

Parameters:
visible - true to turn on visibility, false to hide.

update

void update(java.util.Observable obs,
            java.lang.Object obj)
Update the ui when notified by the game.

Specified by:
update in interface java.util.Observer
Parameters:
obs - which observable notified us
obj - an object passed from the observable

showWin

void showWin()
Display that the player won the game.


showLose

void showLose(java.lang.String message)
Display that the player lost the game. Reveal the solution.

Parameters:
message - the correct solution to the puzzle

playAgain

void playAgain()
Handle end of game, asking if the player wants another game If yes, start a new game, otherwise exit.