Module ij
Package ij.io

Class OpenDialog


  • public class OpenDialog
    extends java.lang.Object
    This class displays a dialog window from which the user can select an input file.
    • Constructor Summary

      Constructors 
      Constructor Description
      OpenDialog​(java.lang.String title)
      Displays a file open dialog with 'title' as the title.
      OpenDialog​(java.lang.String title, java.lang.String path)
      Displays a file open dialog with 'title' as the title.
      OpenDialog​(java.lang.String title, java.lang.String defaultDir, java.lang.String defaultName)
      Displays a file open dialog, using the specified default directory and file name.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getDefaultDirectory()
      Returns the default directory as a string ending in the separator character ("/" or "\"), or a null string.
      java.lang.String getDirectory()
      Returns the selected directory.
      java.lang.String getFileName()
      Returns the selected file name.
      static java.lang.String getLastDirectory()
      Returns the path to the directory that contains the last file opened or saved, or null if a file has not been opened or saved.
      static java.lang.String getLastName()
      Returns the name of the last file opened by the user using a file open or file save dialog, or using drag and drop.
      java.lang.String getPath()
      Returns the selected file path or null if the dialog was canceled.
      static java.lang.String lookupPathVariable​(java.lang.String path)  
      static void setDefaultDirectory​(java.lang.String dir)
      Sets the default directory.
      static void setLastDirectory​(java.lang.String dir)
      Sets the path to the directory containing the last file opened by the user.
      static void setLastName​(java.lang.String name)
      Sets the name of the last file opened by the user.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OpenDialog

        public OpenDialog​(java.lang.String title)
        Displays a file open dialog with 'title' as the title.
      • OpenDialog

        public OpenDialog​(java.lang.String title,
                          java.lang.String path)
        Displays a file open dialog with 'title' as the title. If 'path' is non-blank, it is used and the dialog is not displayed. Uses and updates the ImageJ default directory.
      • OpenDialog

        public OpenDialog​(java.lang.String title,
                          java.lang.String defaultDir,
                          java.lang.String defaultName)
        Displays a file open dialog, using the specified default directory and file name.
    • Method Detail

      • lookupPathVariable

        public static java.lang.String lookupPathVariable​(java.lang.String path)
      • getDirectory

        public java.lang.String getDirectory()
        Returns the selected directory.
      • getFileName

        public java.lang.String getFileName()
        Returns the selected file name.
      • getPath

        public java.lang.String getPath()
        Returns the selected file path or null if the dialog was canceled.
      • getDefaultDirectory

        public static java.lang.String getDefaultDirectory()
        Returns the default directory as a string ending in the separator character ("/" or "\"), or a null string. Returns the current working directory if called from a command line macro and setDefaultDirectory() has not been called.
      • getLastDirectory

        public static java.lang.String getLastDirectory()
        Returns the path to the directory that contains the last file opened or saved, or null if a file has not been opened or saved.
      • setLastDirectory

        public static void setLastDirectory​(java.lang.String dir)
        Sets the path to the directory containing the last file opened by the user.
      • getLastName

        public static java.lang.String getLastName()
        Returns the name of the last file opened by the user using a file open or file save dialog, or using drag and drop. Returns null if the users has not opened a file.
      • setLastName

        public static void setLastName​(java.lang.String name)
        Sets the name of the last file opened by the user.