|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJTP.IO
public class IO
Set of methods for loading levelsets with appropriate the error handling.
Field Summary | |
---|---|
static int |
EDITOR_LOAD
LevelSet will be loaded in editor. |
static int |
EDITOR_NEW
LevelSet will be created in editor. |
static int |
GAME_LOAD
LevelSet will be loaded for play. |
Constructor Summary | |
---|---|
IO()
|
Method Summary | |
---|---|
static boolean |
editorLoadLevelSet(Editor editor,
String filename,
JOptionPane op,
Screen c,
Graphics2D g)
Tries to load the given file for editing. |
static boolean |
gameLoadLevelSet(GamePlayer gamePlayer,
String filename,
JOptionPane op,
Screen c,
int gameMode,
Graphics2D g)
Tries to load the given file for play. |
static boolean |
gameLoadLevelSet(GamePlayer gamePlayer,
URL fileURL,
JOptionPane op,
Screen c,
int gameMode,
Graphics2D g)
Tries to load the given file for play. |
static String |
getUserFile(JFileChooser fc,
int requestType,
String fileExtension,
Screen c)
Prompts user for level set file and returns the absolute path to the chosen file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int GAME_LOAD
LevelSet
will be loaded for play.
public static final int EDITOR_NEW
LevelSet
will be created in editor.
public static final int EDITOR_LOAD
LevelSet
will be loaded in editor.
Constructor Detail |
---|
public IO()
Method Detail |
---|
public static boolean editorLoadLevelSet(Editor editor, String filename, JOptionPane op, Screen c, Graphics2D g)
editor
- instance of Editor
used for editing.filename
- absolute or relative location of file to load.op
- instance of JOptionPane
to use for displaying
error messages to the user.c
- parent rendering class (required by JOptionPane
).g
- graphics context for updating editor layout.
true
if the levelset was loaded successfully.public static boolean gameLoadLevelSet(GamePlayer gamePlayer, String filename, JOptionPane op, Screen c, int gameMode, Graphics2D g)
gamePlayer
- instance of GamePlayer
used for playing.filename
- absolute or relative location of file to load.op
- instance of JOptionPane
to use for displaying
error messages to the user.c
- parent rendering class (required by JOptionPane
).gameMode
- type of game to set up. See GamePlayer
for
possible modes.g
- graphics context for updating in-game layout.
true
if the levelset was loaded successfully.public static boolean gameLoadLevelSet(GamePlayer gamePlayer, URL fileURL, JOptionPane op, Screen c, int gameMode, Graphics2D g)
gamePlayer
- instance of GamePlayer
used for playing.fileURL
- location of file to load.op
- instance of JOptionPane
to use for displaying
error messages to the user.c
- parent rendering class (required by JOptionPane
).gameMode
- type of game to set up. See GamePlayer
for
possible modes.g
- graphics context for updating in-game layout.
true
if the levelset was loaded successfully.public static String getUserFile(JFileChooser fc, int requestType, String fileExtension, Screen c) throws IllegalArgumentException, NullPointerException
fileExtension
.
fc
- instance of JFileChooser
for user to select file
with.requestType
- one of GAME_LOAD
, EDITOR_NEW
or EDITOR_LOAD
. This dictates the type of error messages
shown to the user.fileExtension
- to add to filename, if not already present.c
- parent rendering class (required by JFileChooser
).
null
.
IllegalArgumentException
- if requestType
is not one of
the types specified in this class.
NullPointerException
- if any of fc
,
fileExtension
or c
are null
.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |