ij.io
Class OpenDialog

java.lang.Object
  extended by ij.io.OpenDialog

public class OpenDialog
extends Object

This class displays a dialog window from which the user can select an input file.


Constructor Summary
OpenDialog(String title)
          Displays a file open dialog with 'title' as the title.
OpenDialog(String title, String path)
          Displays a file open dialog with 'title' as the title.
OpenDialog(String title, String defaultDir, String defaultName)
          Displays a file open dialog, using the specified default directory and file name.
 
Method Summary
static String getDefaultDirectory()
          Returns the current working directory, which may be null.
 String getDirectory()
          Returns the selected directory.
 String getFileName()
          Returns the selected file name.
static String getLastDirectory()
          Returns the path to the last directory opened by the user using a file open or file save dialog, or using drag and drop.
static 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.
 String getPath()
          Returns the selected file path or null if the dialog was canceled.
static String lookupPathVariable(String path)
           
static void setDefaultDirectory(String defaultDir)
          Sets the current working directory.
static void setLastDirectory(String dir)
          Sets the path to the directory containing the last file opened by the user.
static void setLastName(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(String title)
Displays a file open dialog with 'title' as the title.


OpenDialog

public OpenDialog(String title,
                  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(String title,
                  String defaultDir,
                  String defaultName)
Displays a file open dialog, using the specified default directory and file name.

Method Detail

lookupPathVariable

public static String lookupPathVariable(String path)

getDirectory

public String getDirectory()
Returns the selected directory.


getFileName

public String getFileName()
Returns the selected file name.


getPath

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


getDefaultDirectory

public static String getDefaultDirectory()
Returns the current working directory, which may be null. The returned string always ends with the separator character ("/" or "\").


setDefaultDirectory

public static void setDefaultDirectory(String defaultDir)
Sets the current working directory.


getLastDirectory

public static String getLastDirectory()
Returns the path to the last directory 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.


setLastDirectory

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


getLastName

public static 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(String name)
Sets the name of the last file opened by the user.



Copyright © 1997–2015 NIH. All rights reserved.