- java.lang.Object
-
- ij.WindowManager
-
public class WindowManager extends Object
This class consists of static methods used to manage ImageJ's windows.
-
-
Field Summary
Fields Modifier and Type Field Description static booleancheckForDuplicateName
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddWindow(Frame win)Adds the specified Frame to the Window menu.static voidaddWindow(Window win)Adds the specified window to the Window menu.static booleancloseAllWindows()Closes all windows.static WindowgetActiveTable()Returns the Window containing the active table, or null.static WindowgetActiveWindow()Returns the front most window or null.static Window[]getAllNonImageWindows()Returns an array containing a list of the non-image Frames and Dialogs.static ImagePlusgetCurrentImage()Returns a reference to the active image or null if there isn't one.static ImageWindowgetCurrentWindow()Returns the active ImageWindow.static FramegetFrame(String title)Obsolete; replaced by getWindow().static FramegetFrontWindow()Obsolete; replaced by getActiveWindow.static int[]getIDList()Returns a list of the IDs of open images.static ImagePlusgetImage(int imageID)For IDs less than zero, returns the ImagePlus with the specified ID.static ImagePlusgetImage(String title)Returns the first image that has the specified title or null if it is not found.static intgetImageCount()Returns the number of open images.static String[]getImageTitles()Returns a list of the titles of all open images.static String[]getNonImageTitles()Returns an array containing the titles of non-image Frames and Dialogs.static Frame[]getNonImageWindows()Returns an array containing a list of the non-image Frames.static intgetNthImageID(int n)Returns the ID of the Nth open image.static ImagePlusgetTempCurrentImage()Returns the temporary current image for this thread, or null.static StringgetUniqueName(ImagePlus imp, String name)static StringgetUniqueName(String name)Returns a unique name by adding, before the extension, -1, -2, etc.static WindowgetWindow(String title)Returns the window (a Frame or a Dialog) with the specified title, or null if a window with that title is not found.static intgetWindowCount()Returns the number of open image windows.static StringmakeUniqueName(String name)If 'name' is not unique, adds -1, -2, etc.static voidputBehind()Activates the next image window on the window list.static voidremoveWindow(Frame win)Removes the specified Frame from the Window menu.static voidremoveWindow(Window win)Removes the specified window from the Window menu.static voidrepaintImageWindows()Repaints all open image windows.static voidsetCurrentWindow(ImageWindow win)Makes the image contained in the specified window the active image.static voidsetTempCurrentImage(ImagePlus img)Makes the specified image temporarily the active image for this thread.static voidsetTempCurrentImage(Thread thread, ImagePlus img)Sets a temporary image for the specified thread.static voidsetWindow(Frame win)The specified frame becomes the front window, the one returnd by getFrontWindow().static voidsetWindow(Window win)The specified Window becomes the front window.static voidshowList()static voidtoFront(Frame frame)static voidtoFront(Window window)
-
-
-
Method Detail
-
setCurrentWindow
public static void setCurrentWindow(ImageWindow win)
Makes the image contained in the specified window the active image.
-
getCurrentWindow
public static ImageWindow getCurrentWindow()
Returns the active ImageWindow.
-
getCurrentImage
public static ImagePlus getCurrentImage()
Returns a reference to the active image or null if there isn't one.- See Also:
IJ.getImage()
-
setTempCurrentImage
public static void setTempCurrentImage(ImagePlus img)
Makes the specified image temporarily the active image for this thread. Call again with a null argument to revert to the previous active image.
-
setTempCurrentImage
public static void setTempCurrentImage(Thread thread, ImagePlus img)
Sets a temporary image for the specified thread.
-
getWindowCount
public static int getWindowCount()
Returns the number of open image windows.
-
getImageCount
public static int getImageCount()
Returns the number of open images.
-
getActiveWindow
public static Window getActiveWindow()
Returns the front most window or null.
-
getActiveTable
public static Window getActiveTable()
Returns the Window containing the active table, or null.- See Also:
ResultsTable.getActiveTable()
-
getFrontWindow
public static Frame getFrontWindow()
Obsolete; replaced by getActiveWindow.
-
getIDList
public static int[] getIDList()
Returns a list of the IDs of open images. Returns null if no image windows are open.
-
getImageTitles
public static String[] getImageTitles()
Returns a list of the titles of all open images.
-
getNonImageWindows
public static Frame[] getNonImageWindows()
Returns an array containing a list of the non-image Frames.
-
getAllNonImageWindows
public static Window[] getAllNonImageWindows()
Returns an array containing a list of the non-image Frames and Dialogs.
-
getNonImageTitles
public static String[] getNonImageTitles()
Returns an array containing the titles of non-image Frames and Dialogs.
-
getImage
public static ImagePlus getImage(int imageID)
For IDs less than zero, returns the ImagePlus with the specified ID. Returns null if no open window has a matching ID or no images are open. For IDs greater than zero, returns the Nth ImagePlus. Returns null if the ID is zero.
-
getNthImageID
public static int getNthImageID(int n)
Returns the ID of the Nth open image. Returns zero if n<=0 or n greater than the number of open image windows.
-
getImage
public static ImagePlus getImage(String title)
Returns the first image that has the specified title or null if it is not found.
-
addWindow
public static void addWindow(Window win)
Adds the specified window to the Window menu.
-
addWindow
public static void addWindow(Frame win)
Adds the specified Frame to the Window menu.
-
getUniqueName
public static String getUniqueName(String name)
Returns a unique name by adding, before the extension, -1, -2, etc. as needed.
-
makeUniqueName
public static String makeUniqueName(String name)
If 'name' is not unique, adds -1, -2, etc. as needed to make it unique.
-
removeWindow
public static void removeWindow(Window win)
Removes the specified window from the Window menu.
-
removeWindow
public static void removeWindow(Frame win)
Removes the specified Frame from the Window menu.
-
setWindow
public static void setWindow(Window win)
The specified Window becomes the front window.
-
setWindow
public static void setWindow(Frame win)
The specified frame becomes the front window, the one returnd by getFrontWindow().
-
closeAllWindows
public static boolean closeAllWindows()
Closes all windows. Stops and returns false if an image or Editor "save changes" dialog is canceled.
-
putBehind
public static void putBehind()
Activates the next image window on the window list.
-
getTempCurrentImage
public static ImagePlus getTempCurrentImage()
Returns the temporary current image for this thread, or null.
-
getWindow
public static Window getWindow(String title)
Returns the window (a Frame or a Dialog) with the specified title, or null if a window with that title is not found.
-
repaintImageWindows
public static void repaintImageWindows()
Repaints all open image windows.
-
showList
public static void showList()
-
toFront
public static void toFront(Frame frame)
-
toFront
public static void toFront(Window window)
-
-