|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.game.JDefaultGame
public class JDefaultGame
JDefaultGame provides a basic wrapper for GamePlay objects for implementing the JGamePlay interface. JDefaultGame enables any GamePlay to be played with a JGameFrame if the game has no specific requirements for its display (or you can extend this class to ease the implementation of the interface). JDefaultGame relies on proper toString() methods to be set for the game and its moves; it further requires that a default constructor with no arguments is accessible from this class. Also, the GamePlay and all its associated objects must be serializable for game saving/loading.
JGameFrame,
JGamePlay| Field Summary | |
|---|---|
protected ExtensionFileFilter |
filter
|
protected GameGUI |
frame
|
protected AutoPlay |
play
|
| Fields inherited from interface com.antelmann.game.JGamePlay |
|---|
gameFrameX, gameFrameY, historyFrameX, historyFrameY, legalMovesFrameX, legalMovesFrameY, prototypeCellValue, redoFrameX, redoFrameY, windowHeight, windowLocationX, windowLocationY, windowWidth |
| Constructor Summary | |
|---|---|
JDefaultGame(GamePlay game)
|
|
JDefaultGame(GamePlay game,
Player[] player,
int level,
ExtensionFileFilter filter)
|
|
| Method Summary | |
|---|---|
AutoPlay |
getAutoPlay()
AutoPlay() returns the underlying game - to allow the calling functions to perform operations on the game itself. |
Container |
getContainer(GameGUI frame)
takes the toString() function of the GamePlay and turns it into formatted html, which is returned as a JLabel |
String |
getDefaultFileExtension()
getDefaultFileExtension() defines the String used as a file type when saving files; it should correspond to getFileFlter. |
FileFilter |
getFileFilter()
getFileFilter() provides the option to filter for certain file types when saving or loading games. |
Container |
getHelp()
returns null if not overridden |
JMenu |
getMenu()
returns null if not overridden |
JGamePlay |
getNewGame()
depends on a default constructor being accessible for the GamePlay object in question |
String |
getStatusMessage()
indicates the number of moves performed, number of legal moves available, and indicates if someone won the game. |
String |
getTitle()
returns getGameName() from the GamePlay object |
protected void |
setFileFilter(ExtensionFileFilter filter)
|
JGamePlay |
setGame(AutoPlay play)
setGame(AbstractGameBoard board) returns a JGamePlay object that embedds the given AutoPlay game. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected GameGUI frame
protected AutoPlay play
protected ExtensionFileFilter filter
| Constructor Detail |
|---|
public JDefaultGame(GamePlay game)
public JDefaultGame(GamePlay game,
Player[] player,
int level,
ExtensionFileFilter filter)
| Method Detail |
|---|
public Container getContainer(GameGUI frame)
getContainer in interface JGamePlayframe - the object to be used to alter the game status
by using the interfacepublic AutoPlay getAutoPlay()
JGamePlay
getAutoPlay in interface JGamePlaypublic FileFilter getFileFilter()
JGamePlay
getFileFilter in interface JGamePlayprotected void setFileFilter(ExtensionFileFilter filter)
public String getDefaultFileExtension()
JGamePlay
getDefaultFileExtension in interface JGamePlaypublic JMenu getMenu()
getMenu in interface JGamePlaypublic JGamePlay getNewGame()
getNewGame in interface JGamePlay
public JGamePlay setGame(AutoPlay play)
throws GameRuntimeException
JGamePlay
setGame in interface JGamePlayGameRuntimeExceptionpublic String getTitle()
getTitle in interface JGamePlayGamePlay.getGameName()public String getStatusMessage()
getStatusMessage in interface JGamePlaypublic Container getHelp()
getHelp in interface JGamePlay
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||