All Packages Class Hierarchy This Package Previous Next Index
Class kpalin.alabra.FileIO
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Window
|
+----java.awt.Dialog
|
+----java.awt.FileDialog
|
+----kpalin.alabra.FileIO
- public class FileIO
- extends FileDialog
- implements FilenameFilter
Here we control all saving and loading of game. The game is saved
brutaly by saving the ChessPlay object, but this class is writen
for general object so we can change the implementation easily.
- Author:
- Kimmo Palin
-
fileSuffix
- Identification suffix of the files.
-
LOADTITLE
-
-
savefile
- Name of the file where current game has been saved.
-
saveObject
- Object that this object controls.
-
SAVETITLE
-
-
FileIO(Frame)
- Creates new object for handling game saving and loading.
-
FileIO(Frame, Object)
- Creates new object for handling game saving and loading.
-
accept(File, String)
- Controls what files to show on dialog and what not.
-
getFileName()
-
-
getLoadName()
- Asks the name of the game to be load.
-
getObject()
- Returns the target of this object.
-
getSaveName()
-
-
loadData()
- Loads the object from the savefile.
-
loadFile()
- Asks the name of the game to be load and loads it.
-
saveData()
- Saves game with a given name.
-
saveFile()
-
-
saveFileAs()
-
-
setFileName(String)
-
-
setObject(Object)
- Sets new object for this FileIO to handle.
fileSuffix
private final String fileSuffix
- Identification suffix of the files.
SAVETITLE
private final String SAVETITLE
LOADTITLE
private final String LOADTITLE
saveObject
private Object saveObject
- Object that this object controls.
savefile
private String savefile
- Name of the file where current game has been saved.
FileIO
FileIO(Frame parent)
- Creates new object for handling game saving and loading.
- Parameters:
- parent - Parent frame of the possible FileDialog
FileIO
FileIO(Frame parent,
Object save)
- Creates new object for handling game saving and loading.
- Parameters:
- parent - Parent frame of the possible FileDialog
- save - The object to be saved.
setObject
public void setObject(Object target)
- Sets new object for this FileIO to handle.
setFileName
public void setFileName(String name)
getFileName
public String getFileName()
getObject
public Object getObject()
- Returns the target of this object.
accept
public boolean accept(File dir,
String name)
- Controls what files to show on dialog and what not.
saveFileAs
public boolean saveFileAs()
saveFile
public boolean saveFile()
getSaveName
private void getSaveName()
saveData
public boolean saveData()
- Saves game with a given name.
- Returns:
- true if save was succesful, otherwise false.
loadFile
public boolean loadFile()
- Asks the name of the game to be load and loads it.
getLoadName
private void getLoadName()
- Asks the name of the game to be load.
loadData
public boolean loadData()
- Loads the object from the savefile.
All Packages Class Hierarchy This Package Previous Next Index