NGP
Class Utilities

java.lang.Object
  extended byNGP.Utilities

public final class Utilities
extends Object

Contains a number of "utility" methods to help in programming.

Author:
Matt Chotin (mhc)

Method Summary
static URL createURL(String url)
          Create a URL object from a String.
static Color randomColor()
          Generate a random Color
static int randomNumber(int low, int high)
          Generate a random integer between the two parameters (inclusive)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

randomNumber

public static int randomNumber(int low,
                               int high)
Generate a random integer between the two parameters (inclusive)

Parameters:
low - the lower bound
high - the upper bound
Returns:
a random int between low and high (inclusive)

randomColor

public static Color randomColor()
Generate a random Color

Returns:
a random Color
See Also:
java.awt.Color

createURL

public static URL createURL(String url)
Create a URL object from a String. Pass the String in as if you were typing it into a web browser (i.e., fully qualified), e.g., http://www.cs.brown.edu/courses/cs015 or file:/pro/web/web/courses/cs015/home.html.

Parameters:
url - the String representing the actual address
Returns:
the URL object (null if badly formed)
See Also:
java.net.URL