org.haphazard.gui
Class GlobalOptions

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended byjava.util.Properties
              extended byorg.haphazard.gui.GlobalOptions
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class GlobalOptions
extends java.util.Properties

GlobalOptions are settings that are persistent between runs. They can be modified by the user by editing a text file. All properties has functions and default values when accessing them. If a needed property is not known, the class should take actions inquiring the user to find out the value

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Method Summary
 int getBanditTimer()
          Gets the time in ms that should elapse before a new bandit is spawned.
 java.io.File getGraphics()
          Gets the jar-file alt. directory where the graphics should be located
static GlobalOptions getInstance()
          Gets an instance of this object
 int getPort()
          Gets the time in ms that should elapse before a new bandit is spawned.
 void init(javax.swing.JFrame owner, java.lang.String filename)
          Initiates this object
 void setFile(java.lang.String filename)
          Sets the file this object should work against.
 boolean useFogOfWar()
          Checks if the fog of war should be used
 boolean useGraphics()
          Checks if graphics should be used
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, propertyNames, save, setProperty, store
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static GlobalOptions getInstance()
Gets an instance of this object

Returns:
The singleton instance

init

public void init(javax.swing.JFrame owner,
                 java.lang.String filename)
Initiates this object

Parameters:
owner - The Frame that owns this object
filename - The property file to work against

setFile

public void setFile(java.lang.String filename)
Sets the file this object should work against.

Parameters:
filename - The filename of the initializer file

getGraphics

public java.io.File getGraphics()
Gets the jar-file alt. directory where the graphics should be located

Returns:
The File descriptor for the location of the graphics directory

useGraphics

public boolean useGraphics()
Checks if graphics should be used

Returns:
True if graphics should be used

getBanditTimer

public int getBanditTimer()
Gets the time in ms that should elapse before a new bandit is spawned.

Returns:
int The time in milliseconds

getPort

public int getPort()
Gets the time in ms that should elapse before a new bandit is spawned.

Returns:
int The time in milliseconds

useFogOfWar

public boolean useFogOfWar()
Checks if the fog of war should be used

Returns:
True if the fog of war should be used