## visad.util
Class Util

    java.lang.Object
      visad.util.Util

public class Util
extends Object

A hodge-podge of general utility methods.

Constructor Summary
`Util()`

Method Summary
`static void` `adjustComboBox(JComboBox combo)` Limit the given combo box to one line in height.
`static void` `adjustTextField(JTextField field)` Limit the given text field to one line in height.
`static boolean` `arraysEqual(Object[] o1, Object[] o2)` Tests whether two arrays are component-wise equal.
`static boolean` `canDoHDF5()` Test whether HDF-5 native code is present in this JVM.
`static boolean` `canDoImageJ()` Test whether ImageJ is present in this JVM.
`static boolean` `canDoJAI()` Test whether Java Advanced Imaging is present in this JVM.
`static boolean` `canDoJava3D()` Test whether Java3D is present in this JVM.
`static boolean` `canDoJava3D(String version)` Check to see if the version of Java3D being used is compatible with the desired specification version.
`static boolean` `canDoJPEG()` Test whether JPEG codec (com.sun.image.codec.jpeg) is present in this JVM.
`static boolean` `canDoPython()` Test whether Jython is present in this JVM.
`static boolean` `canDoQuickTime()` Test whether QuickTime for Java is present in this JVM.
`static void` `captureDisplay(DisplayImpl display, String filename)` Capture a DisplayImpl into a JPEG file
`static void` `captureDisplay(DisplayImpl display, String filename, boolean sync)` Capture a DisplayImpl into a JPEG file
`static void` `centerWindow(Window window)` Center the given window on the screen.
`static void` `centerWindow(Window parent, Window window)` Center the given window within the specified parent window.
`static ConstantMap[]` `getColorMaps(Color color)` Create a ConstantMap array of colors for use with
`static String` `getTimestamp()` Return a string representation of the current date and time.
`static String` `getVersionDate()` Return a string representation of VisAD's build date and time.
`static JFileChooser` `getVisADFileChooser()` Return a JFileChooser that recognizes supported VisAD file types.
`static void` `invoke(boolean wait, boolean printStackTraces, Runnable r)` Executes the given Runnable object with the Swing event handling thread.
`static void` `invoke(boolean wait, Runnable r)` Executes the given Runnable object with the Swing event handling thread.
`static boolean` `isApproximatelyEqual(double a, double b)` Determine whether two numbers are roughly the same.
`static boolean` `isApproximatelyEqual(double a, double b, double epsilon)` Determine whether two numbers are roughly the same.
`static boolean` `isApproximatelyEqual(float a, float b)` Determine whether two numbers are roughly the same.
`static boolean` `isApproximatelyEqual(float a, float b, float epsilon)` Determine whether two numbers are roughly the same.
`static void` `printArray(String prefix, double[] array)` Print out the values in a double array.
`static void` `printArray(String prefix, Object[] array)` Create a string representation of the given array

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Util

    public Util()

Method Detail

### isApproximatelyEqual

    public static boolean isApproximatelyEqual(float a,
                                               float b,
                                               float epsilon)

  Determine whether two numbers are roughly the same.

  Parameters:
    `a` - First number
    `b` - Second number
    `epsilon` - Absolute amount by which they can differ.
  Returns:
    `true` if they're approximately equal.

### isApproximatelyEqual

    public static boolean isApproximatelyEqual(float a,
                                               float b)

  Determine whether two numbers are roughly the same.

  Parameters:
    `a` - First number
    `b` - Second number
  Returns:
    `true` if they're approximately equal.

### isApproximatelyEqual

    public static boolean isApproximatelyEqual(double a,
                                               double b,
                                               double epsilon)

  Determine whether two numbers are roughly the same.

  Parameters:
    `a` - First number
    `b` - Second number
    `epsilon` - Absolute amount by which they can differ.
  Returns:
    `true` if they're approximately equal.

### isApproximatelyEqual

    public static boolean isApproximatelyEqual(double a,
                                               double b)

  Determine whether two numbers are roughly the same.

  Parameters:
    `a` - First number
    `b` - Second number
  Returns:
    `true` if they're approximately equal.

### getVersionDate

    public static String getVersionDate()

  Return a string representation of VisAD's build date and time.

### getTimestamp

    public static String getTimestamp()

  Return a string representation of the current date and time.

### getVisADFileChooser

    public static JFileChooser getVisADFileChooser()

  Return a JFileChooser that recognizes supported VisAD file types.

### adjustTextField

    public static void adjustTextField(JTextField field)

  Limit the given text field to one line in height.

### adjustComboBox

    public static void adjustComboBox(JComboBox combo)

  Limit the given combo box to one line in height.

### centerWindow

    public static void centerWindow(Window window)

  Center the given window on the screen.

### centerWindow

    public static void centerWindow(Window parent,
                                    Window window)

  Center the given window within the specified parent window.

### canDoHDF5

    public static boolean canDoHDF5()

  Test whether HDF-5 native code is present in this JVM.

  Returns:
    true if found, otherwise false

### canDoImageJ

    public static boolean canDoImageJ()

  Test whether ImageJ is present in this JVM.

  Returns:
    true if found, otherwise false

### canDoJPEG

    public static boolean canDoJPEG()

  Test whether JPEG codec (com.sun.image.codec.jpeg) is present in this JVM.

  Returns:
    true if found, otherwise false

### canDoJAI

    public static boolean canDoJAI()

  Test whether Java Advanced Imaging is present in this JVM.

  Returns:
    true if found, otherwise false

### canDoPython

    public static boolean canDoPython()

  Test whether Jython is present in this JVM.

  Returns:
    true if found, otherwise false

### canDoQuickTime

    public static boolean canDoQuickTime()

  Test whether QuickTime for Java is present in this JVM.

  Returns:
    true if found, otherwise false

### canDoJava3D

    public static boolean canDoJava3D()

  Test whether Java3D is present in this JVM.

  Returns:
    true if found, otherwise false

### canDoJava3D

    public static boolean canDoJava3D(String version)

  Check to see if the version of Java3D being used is compatible with the desired specification version.

  Parameters:
    `version` - version to check. Needs to conform to the dotted format of specification version numbers (e.g., 1.2)
  Returns:
    true if the Java3D version being used is greater than or equal to the desired version number

### captureDisplay

    public static void captureDisplay(DisplayImpl display,
                                      String filename)

  Capture a DisplayImpl into a JPEG file

  Parameters:
    `display` - the DisplayImpl to capture
    `filename` - the name of the file to write into

### captureDisplay

    public static void captureDisplay(DisplayImpl display,
                                      String filename,
                                      boolean sync)

  Capture a DisplayImpl into a JPEG file

  Parameters:
    `display` - the DisplayImpl to capture
    `filename` - the name of the file to write into
    `sync` - ensure the display is "done" if true

### arraysEqual

    public static boolean arraysEqual(Object[] o1,
                                      Object[] o2)

  Tests whether two arrays are component-wise equal.

### printArray

    public static void printArray(String prefix,
                                  Object[] array)

  Create a string representation of the given array

  Parameters:
    `array` - array to print
  Returns:
    array as a String

### printArray

    public static void printArray(String prefix,
                                  double[] array)

  Print out the values in a double array.

  Parameters:
    `prefix` - prefix string
    `array` - array to print

### invoke

    public static void invoke(boolean wait,
                              Runnable r)

  Executes the given Runnable object with the Swing event handling thread.

  Parameters:
    `wait` - `true` if method should block until Runnable code finishes execution.
    `r` - Runnable object to execute using the event handling thread.

### invoke

    public static void invoke(boolean wait,
                              boolean printStackTraces,
                              Runnable r)

  Executes the given Runnable object with the Swing event handling thread.

  Parameters:
    `wait` - `true` if method should block until Runnable code finishes execution.
    `printStackTraces` - `true` if the stack trace for any exception should be printed.
    `r` - Runnable object to execute using the event handling thread.

### getColorMaps

    public static ConstantMap[] getColorMaps(Color color)
                                      throws VisADException

  Create a ConstantMap array of colors for use with

  Parameters:
    `color` - color to encode
  Returns:
    an array containing either 3 colors or, if the `color` parameter included an alpha component, a 4 element array with 3 colors and an @{link Display.Alpha alpha} component.
  Throws:
    `VisADException`