org.geotools.swt.control
Class JFileImageChooser

Object
  extended by JFileImageChooser

public class JFileImageChooser
extends Object

A file chooser dialog for common raster image format files. It provides static methods to display the dialog for opening or saving an image file with basic validation of user input.


 // Prompting for an input image file
 File file = JFileImageChooser.showOpenFile(null);
 if (file != null) {
     ...
 }

 // Prompting for a file name to save an image
 File file = JFileImageChooser.showSaveFile(null);
 if (file != null) {
     ...
 }
 
The file formats offered by the dialog are a subset of those supported by ImageIO on the host system.

Author:
Andrea Antonello (www.hydrologis.com), Michael Bedward
See Also:
JFileDataStoreChooser, JParameterListWizard, ImageIO

Constructor Summary
JFileImageChooser(Shell parent, int style)
           
JFileImageChooser(Shell parent, int style, File workingDir)
          Create a new image file chooser
 
Method Summary
 FileDialog getFileDialog()
           
static File showOpenFile(Shell parent)
          Display a dialog to choose an image file to open
static File showOpenFile(Shell parent, File workingDir)
          Display a dialog to choose an image file to open
static File showSaveFile(Shell parent)
          Display a dialog to choose a file name to save an image to
static File showSaveFile(Shell parent, File workingDir)
          Display a dialog to choose a file name to save an image to
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JFileImageChooser

public JFileImageChooser(Shell parent,
                         int style)

JFileImageChooser

public JFileImageChooser(Shell parent,
                         int style,
                         File workingDir)
Create a new image file chooser

Parameters:
workingDir - the initial directory to display
Method Detail

getFileDialog

public FileDialog getFileDialog()

showSaveFile

public static File showSaveFile(Shell parent)
Display a dialog to choose a file name to save an image to

Parameters:
parent - parent component (may be null)
Returns:
the selected file or null if the dialog was cancelled

showSaveFile

public static File showSaveFile(Shell parent,
                                File workingDir)
Display a dialog to choose a file name to save an image to

Parameters:
parent - parent component (may be null)
workingDir - the initial directory to display
Returns:
the selected file or null if the dialog was cancelled

showOpenFile

public static File showOpenFile(Shell parent)
Display a dialog to choose an image file to open

Parameters:
parent - parent component (may be null)
workingDir - the initial directory to display
Returns:
the selected file or null if the dialog was cancelled

showOpenFile

public static File showOpenFile(Shell parent,
                                File workingDir)
Display a dialog to choose an image file to open

Parameters:
parent - parent component (may be null)
workingDir - the initial directory to display
Returns:
the selected file or null if the dialog was cancelled


Copyright © 1996-2014 Geotools. All Rights Reserved.