Holger's
Java API

com.antelmann.game.puzzle
Class JTilePuzzle

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.antelmann.game.puzzle.JTilePuzzle
All Implemented Interfaces:
JGamePlay, ActionListener, Serializable, EventListener, TableModel

public class JTilePuzzle
extends AbstractTableModel
implements JGamePlay, ActionListener

implements the GUI wrapper for the TilePuzzle

Author:
Holger Antelmann
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Fields inherited from interface com.antelmann.game.JGamePlay
gameFrameX, gameFrameY, historyFrameX, historyFrameY, legalMovesFrameX, legalMovesFrameY, prototypeCellValue, redoFrameX, redoFrameY, windowHeight, windowLocationX, windowLocationY, windowWidth
 
Constructor Summary
JTilePuzzle()
           
JTilePuzzle(TilePuzzle game, Player player, int level)
           
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 AutoPlay getAutoPlay()
          AutoPlay() returns the underlying game - to allow the calling functions to perform operations on the game itself.
 int getColumnCount()
           
 Container getContainer(GameGUI frame)
          getContainer() returns the GUI component used to display the game representation.
 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()
          getHelp() is to return a component (such as JLabel, JTextArea, etc) that can be displayed if a user selects the game specific help menu from a JGameFrame.
 JMenu getMenu()
          getMenu() provides the option to display a game specific menu within the overall JMenuBar of the JGameFrame.
 JGamePlay getNewGame()
          getNewGame() will initialize a new game and return the JGamePlay wrapper associated with the new game.
 int getRowCount()
           
 String getStatusMessage()
          getStatusMessage () is used to display a game specific status message, giving some information about the running game.
 String getTitle()
          getTitle() returns a string used in JGameFrame to be displayed in the title bar of the top JFrame.
 Object getValueAt(int row, int column)
           
 JGamePlay setGame(AutoPlay play)
          setGame(AbstractGameBoard board) returns a JGamePlay object that embedds the given AutoPlay game.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JTilePuzzle

public JTilePuzzle()

JTilePuzzle

public JTilePuzzle(TilePuzzle game,
                   Player player,
                   int level)
Method Detail

getTitle

public String getTitle()
Description copied from interface: JGamePlay
getTitle() returns a string used in JGameFrame to be displayed in the title bar of the top JFrame.

Specified by:
getTitle in interface JGamePlay

getStatusMessage

public String getStatusMessage()
Description copied from interface: JGamePlay
getStatusMessage () is used to display a game specific status message, giving some information about the running game. JGameFrame uses the return value for display in the status toolbar after a move is carried out.

Specified by:
getStatusMessage in interface JGamePlay

getContainer

public Container getContainer(GameGUI frame)
Description copied from interface: JGamePlay
getContainer() returns the GUI component used to display the game representation.

Specified by:
getContainer in interface JGamePlay
Parameters:
frame - the object to be used to alter the game status by using the interface

getAutoPlay

public AutoPlay getAutoPlay()
Description copied from interface: JGamePlay
AutoPlay() returns the underlying game - to allow the calling functions to perform operations on the game itself.

Specified by:
getAutoPlay in interface JGamePlay

getFileFilter

public FileFilter getFileFilter()
Description copied from interface: JGamePlay
getFileFilter() provides the option to filter for certain file types when saving or loading games.

Specified by:
getFileFilter in interface JGamePlay

getDefaultFileExtension

public String getDefaultFileExtension()
Description copied from interface: JGamePlay
getDefaultFileExtension() defines the String used as a file type when saving files; it should correspond to getFileFlter. Example: if getDefaultFileExtension() returns "test" and the user doesn't enter a file extension for the game to save but simply "game1", then the file saved will be name "game1.test".

Specified by:
getDefaultFileExtension in interface JGamePlay

getMenu

public JMenu getMenu()
Description copied from interface: JGamePlay
getMenu() provides the option to display a game specific menu within the overall JMenuBar of the JGameFrame.

Specified by:
getMenu in interface JGamePlay

getNewGame

public JGamePlay getNewGame()
Description copied from interface: JGamePlay
getNewGame() will initialize a new game and return the JGamePlay wrapper associated with the new game.

Specified by:
getNewGame in interface JGamePlay

setGame

public JGamePlay setGame(AutoPlay play)
                  throws GameRuntimeException
Description copied from interface: JGamePlay
setGame(AbstractGameBoard board) returns a JGamePlay object that embedds the given AutoPlay game. This function enables the JGameFrame to load a game and transform it into a JGamePlay in a game specific way. If the given board doesn't match the implementation of JGamePlay, an exception is thrown.

Specified by:
setGame in interface JGamePlay
Throws:
GameRuntimeException

getHelp

public Container getHelp()
Description copied from interface: JGamePlay
getHelp() is to return a component (such as JLabel, JTextArea, etc) that can be displayed if a user selects the game specific help menu from a JGameFrame. It is ok to return null, in which case the JGameFrame will display a message that no specific help is available.

Specified by:
getHelp in interface JGamePlay

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface TableModel

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface TableModel

getValueAt

public Object getValueAt(int row,
                         int column)
Specified by:
getValueAt in interface TableModel


(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads