|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectController
public class Controller
Controller handles user events in the UI.
| Field Summary | |
|---|---|
private Game |
game
Reference to the game we are controlling |
private HangmanUI |
view
Reference to the view we are responding to |
| Constructor Summary | |
|---|---|
Controller(HangmanUI view)
Construct a controller to respond to the specified view |
|
| Method Summary | |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent event)
Handle a button press by the user. |
void |
handlePlayAgainChoice(int choice)
Handle the user's choice for playing again (yes/no) |
void |
setGame(Game game)
Set the reference to the game we are controlling |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Game game
private HangmanUI view
| Constructor Detail |
|---|
public Controller(HangmanUI view)
view - The view this controller responds to| Method Detail |
|---|
public void setGame(Game game)
game - the game to be controlled.public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed in interface java.awt.event.ActionListenerevent - Event to be dispatchedpublic void handlePlayAgainChoice(int choice)
choice - JOptionPane.YES_OPTION=new game, JOptionPane.NO_OPTION=exit
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||