edu.neu.ccs.util
Class JPTUtilities

java.lang.Object
  extended byedu.neu.ccs.util.JPTUtilities
All Implemented Interfaces:
JPTConstants, SwingConstants

public class JPTUtilities
extends Object
implements JPTConstants

Provides general utility methods used by various classes in the JPT.

Several JPT classes can notfy a programmer of a grave programming error by throwing a JPTErrortrue using the setDebugMode method of this class, a JPTError will be handled by the JPT before it is thrown, and a dialog box will be shown to notify the programmer of the error. If debug mode is set to false, as it is by default, a JPTError will be treated almost exactly the same as any other instance of the Error class.

Since:
1.0
Version:
2.2

Field Summary
private static boolean DEBUG
          Debug flag for the toolkit.
 
Fields inherited from interface edu.neu.ccs.util.JPTConstants
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
JPTUtilities()
           
 
Method Summary
static String getBorderLayoutLocation(int alignment)
          Returns the BorderLayout constant corresponding with the given alignment constant.
static boolean isDebugModeSet()
          Returns the toolkit debug flag.
static void pauseThread(long milliseconds)
          Pauses the calling thread for at most the given number of milliseconds.
static void setDebugMode(boolean flag)
          Sets the debug flag for the toolkit to the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static boolean DEBUG
Debug flag for the toolkit.

Constructor Detail

JPTUtilities

public JPTUtilities()
Method Detail

getBorderLayoutLocation

public static String getBorderLayoutLocation(int alignment)
Returns the BorderLayout constant corresponding with the given alignment constant.

Parameters:
alignment - the desired alignment constant

isDebugModeSet

public static boolean isDebugModeSet()
Returns the toolkit debug flag.

See Also:
setDebugMode(boolean)

pauseThread

public static void pauseThread(long milliseconds)
Pauses the calling thread for at most the given number of milliseconds. Since the Thread.sleep method is not perfectly timed to millisecond precision, the actual number of milliseconds the thread pauses will be slightly greater than the given number. If the calling thread is interrupted, this method will return before the given number of milliseconds have elapsed. If the given number of millseconds is less than zero, the calling thread is not paused.

Parameters:
milliseconds - the length of time in milliseconds to pause the calling thread

setDebugMode

public static void setDebugMode(boolean flag)
Sets the debug flag for the toolkit to the given value.

Parameters:
flag - whether or not the toolkit is in debug state
See Also:
isDebugModeSet()