ij
Class IJ

java.lang.Object
  extended by ij.IJ

public class IJ
extends java.lang.Object

This class consists of static utility methods.


Field Summary
static int CANCELED
           
static boolean debugMode
           
 
Constructor Summary
IJ()
           
 
Method Summary
static boolean altKeyDown()
          Returns true if the alt key is down.
static void beep()
          Emits an audio beep.
static java.lang.String d2s(double n)
          Converts a number to a formatted string using 2 digits to the right of the decimal point.
static java.lang.String d2s(double n, int precision)
          Converts a number to a rounded formatted string.
static void doCommand(java.lang.String command)
          Starts executing a menu command in a separete thread and returns immediately.
static void error(java.lang.String msg)
          Displays a message in a dialog box titled "Error".
static java.lang.String freeMemory()
           
static java.applet.Applet getApplet()
          Returns the Applet that created this ImageJ or null if running as an application.
static ImageJ getInstance()
          Returns a reference to the "ImageJ" frame.
static double getNumber(java.lang.String prompt, double defaultNumber)
          Allows the user to enter a number in a dialog box.
static java.lang.String getString(java.lang.String prompt, java.lang.String defaultString)
          Allows the user to enter a string in a dialog box.
static TextPanel getTextPanel()
          Returns a reference to the ImageJ text panel.
static boolean isMacintosh()
          Returns true if this machine is a Macintosh.
static void noImage()
          Displays a "no images are open" dialog box.
static void outOfMemory(java.lang.String name)
          Displays an "out of memory" message in the ImageJ window.
static void register(java.lang.Class c)
          Adds the specified class to a Vector to keep it from being garbage collected, which would cause the classes static fields to be reset.
static void run(java.lang.String command)
          Runs a menu command in the current thread.
static java.lang.Object runPlugIn(java.lang.String className, java.lang.String arg)
          Runs the specified plug-in and returns a reference to it.
static void setColumnHeadings(java.lang.String headings)
          Clears the worksheet and sets the column headings to those in the tab-delimited 'headings' String.
static int setupDialog(ImagePlus imp, int flags)
           
static void showMessage(java.lang.String msg)
          Displays a message in a dialog box titled "Message".
static void showMessage(java.lang.String title, java.lang.String msg)
          Displays a message in a dialog box with the specified title.
static boolean showMessageWithCancel(java.lang.String title, java.lang.String msg)
          Displays a message in a dialog box with the specified title.
static void showProgress(double progress)
          Updates the progress bar.
static void showStatus(java.lang.String s)
          Displays a message in the ImageJ status bar.
static void showTime(ImagePlus imp, long start, java.lang.String str)
           
static boolean spaceBarDown()
          Returns true if the space bar is down.
static boolean versionLessThan(java.lang.String version)
          Displays an error message and returns false if the ImageJ version is less than the one specified.
static void wait(int msecs)
          Delays 'msecs' milliseconds.
static void write(java.lang.String s)
          Displays a line of text in the ImageJ window.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debugMode

public static boolean debugMode

CANCELED

public static final int CANCELED
See Also:
Constant Field Values
Constructor Detail

IJ

public IJ()
Method Detail

getInstance

public static ImageJ getInstance()
Returns a reference to the "ImageJ" frame.


runPlugIn

public static java.lang.Object runPlugIn(java.lang.String className,
                                         java.lang.String arg)
Runs the specified plug-in and returns a reference to it.


doCommand

public static void doCommand(java.lang.String command)
Starts executing a menu command in a separete thread and returns immediately.


run

public static void run(java.lang.String command)
Runs a menu command in the current thread. Does not return until the command has finished executing.


getApplet

public static java.applet.Applet getApplet()
Returns the Applet that created this ImageJ or null if running as an application.


showStatus

public static void showStatus(java.lang.String s)
Displays a message in the ImageJ status bar.


write

public static void write(java.lang.String s)
Displays a line of text in the ImageJ window. Uses System.out.println if ImageJ is not present.


setColumnHeadings

public static void setColumnHeadings(java.lang.String headings)
Clears the worksheet and sets the column headings to those in the tab-delimited 'headings' String.


getTextPanel

public static TextPanel getTextPanel()
Returns a reference to the ImageJ text panel.


noImage

public static void noImage()
Displays a "no images are open" dialog box.


outOfMemory

public static void outOfMemory(java.lang.String name)
Displays an "out of memory" message in the ImageJ window.


showProgress

public static void showProgress(double progress)
Updates the progress bar. Does nothing if the ImageJ window is not present.


showMessage

public static void showMessage(java.lang.String title,
                               java.lang.String msg)
Displays a message in a dialog box with the specified title. Writes the Java console if ImageJ is not present.


showMessage

public static void showMessage(java.lang.String msg)
Displays a message in a dialog box titled "Message". Writes the Java console if ImageJ is not present.


error

public static void error(java.lang.String msg)
Displays a message in a dialog box titled "Error". Writes to the Java console if ImageJ is not present.


showMessageWithCancel

public static boolean showMessageWithCancel(java.lang.String title,
                                            java.lang.String msg)
Displays a message in a dialog box with the specified title. Returns false if the user pressed "Cancel".


getNumber

public static double getNumber(java.lang.String prompt,
                               double defaultNumber)
Allows the user to enter a number in a dialog box. Returns the value IJ.CANCELED (-2,147,483,648) if the user cancels the dialog box


getString

public static java.lang.String getString(java.lang.String prompt,
                                         java.lang.String defaultString)
Allows the user to enter a string in a dialog box. Returns "" if the user cancels the dialog box.


wait

public static void wait(int msecs)
Delays 'msecs' milliseconds.


beep

public static void beep()
Emits an audio beep.


freeMemory

public static java.lang.String freeMemory()

showTime

public static void showTime(ImagePlus imp,
                            long start,
                            java.lang.String str)

d2s

public static java.lang.String d2s(double n)
Converts a number to a formatted string using 2 digits to the right of the decimal point.


d2s

public static java.lang.String d2s(double n,
                                   int precision)
Converts a number to a rounded formatted string. The 'precision' argument specifies the number of digits to the right of the decimal point.


register

public static void register(java.lang.Class c)
Adds the specified class to a Vector to keep it from being garbage collected, which would cause the classes static fields to be reset.


spaceBarDown

public static boolean spaceBarDown()
Returns true if the space bar is down.


altKeyDown

public static boolean altKeyDown()
Returns true if the alt key is down.


isMacintosh

public static boolean isMacintosh()
Returns true if this machine is a Macintosh.


versionLessThan

public static boolean versionLessThan(java.lang.String version)
Displays an error message and returns false if the ImageJ version is less than the one specified.


setupDialog

public static int setupDialog(ImagePlus imp,
                              int flags)