|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectComponent
Container
JComponent
JFileChooser
ImageFileChooser
public class ImageFileChooser
A file chooser for images. Compared to the standard JFileChooser, this class provides
the following additional functionalities:
IIORegistry.showDialog(...) methods display an ImageFileProperties pane
at the right of the ImageFileChooser.
This class should typically be used as below (replace "showOpenDialog" by
"showSaveDialog" for saving an image instead than loading it):
ImageFileChooser chooser = new ImageFileChooser("png", true);
if (chooser.showOpenDialog(parent) == ImageFileChooser.APPROVE_OPTION) {
File selected = chooser.getSelectedFile();
}
ImageFileProperties,
Serialized Form
| display/geotk-widgets-swing (download) | View source code for this class |
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class JFileChooser |
|---|
JFileChooser.AccessibleJFileChooser |
| Nested classes/interfaces inherited from class JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| Fields inherited from class JComponent |
|---|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
ImageFileChooser(String defaultFormat)
Creates a new file chooser having the user's default directory as the initial directory. |
|
ImageFileChooser(String defaultFormat,
boolean showProperties)
Creates a new file chooser, optionally with an ImageFileProperties pane to be shown. |
|
| Method Summary | |
|---|---|
protected JDialog |
createDialog(Component parent)
Creates and returns a new dialog wrapping this ImageFileChooser, optionally
with its ImageFileProperties pane. |
ImageReaderWriterSpi |
getCurrentProvider()
Returns the image reader/writer provider for the currently selected file filter. |
ImageFileProperties |
getPropertiesPane()
Returns the pane showing the properties of the selected file, or null if none. |
File |
getSelectedFile()
Returns the selected file. |
File[] |
getSelectedFiles()
Returns the selected file. |
boolean |
isListFileFilterUsed()
Returns true if this ImageFileChooser should proposes a filter
for list of files. |
void |
resetChoosableFileFilters()
Resets the choosable file filter list to its starting state. |
void |
setDialogType(int mode)
Sets whatever this dialog is going to be used for reading or writing images. |
void |
setListFileFilterUsed(boolean enabled)
Sets whatever this ImageFileChooser should proposes a filter for list of files. |
void |
setPropertiesPane(ImageFileProperties properties)
Sets the pane showing the properties of the selected file, which can be null
for hiding the pane. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ImageFileChooser(String defaultFormat)
The setDialogType(int) method will be invoked implicitly by the
showOpenDialog and showSaveDialog methods.
If those methods are not going to be invoked, then callers should invoke
setDialogType(int) explicitly after construction in order to
add file filters appropriate for
the kind of operation (open or save) to be performed.
defaultFormat - The default format to be initially selected, or null
for proposing all formats. If non-null, it should be an Image I/O format name
like "png" or "jpeg".
public ImageFileChooser(String defaultFormat,
boolean showProperties)
ImageFileProperties pane to be shown.
If showProperties is true, then the properties pane will be visible when the
showDialog method or one of its variants is invoked. The properties pane
is not visible otherwise; see setPropertiesPane(ImageFileProperties) for more
information.
defaultFormat - The default format to be initially selected, or null for all.showProperties - true for creating an ImageFileProperties. The default
value is false.| Method Detail |
|---|
public boolean isListFileFilterUsed()
true if this ImageFileChooser should proposes a filter
for list of files. A "list of files" is a file with .txt, .lst
or .csv extension which contains the actual list of images to select,
which may be spread over many directories.
By default this method returns false.
true if this chooser should proposes the selection of .txt,
.lst or .csv files that contain a list of image files.JFileChooser.isAcceptAllFileFilterUsed()public void setListFileFilterUsed(boolean enabled)
ImageFileChooser should proposes a filter for list of files.
enabled - true if this chooser should proposes the selection of .txt,
.lst or .csv files that contain a list of image files.JFileChooser.setAcceptAllFileFilterUsed(boolean)public void resetChoosableFileFilters()
resetChoosableFileFilters in class JFileChooserpublic ImageFileProperties getPropertiesPane()
null if none.
This is different than the accessory pane provided by
JFileChooser in that this pane is located at the right side of the chooser,
because it is too big for fitting in the accessory area of the file chooser.
null if none.JFileChooser.getAccessory()public void setPropertiesPane(ImageFileProperties properties)
null
for hiding the pane. This method automatically unregister the old pane (if any) from the list of property change listeners, and
register the new pane (if non null) instead.
The properties pane is shown when one of the showDialog method
variants is invoked. If those methods are not going to be used for showing this file
chooser, then the caller shall adds the ImageFileProperties pane himself in
his own pane.
properties - The new pane showing image properties, or null if none.JFileChooser.setAccessory(JComponent)public void setDialogType(int mode)
IIORegistry. Only formats available for reading or writing (depending on the value
of the mode argument) will be listed.
setDialogType in class JFileChoosermode - OPEN_DIALOG for a chooser to be used for reading images, or
SAVE_DIALOG for a chooser to be used for writing images.public File getSelectedFile()
setListFileFilterUsed(true) has been invoked), then this method
returns the list file itself, not its content since this method can only returns a single
file.
getSelectedFile in class JFileChooserpublic File[] getSelectedFiles()
setListFileFilterUsed(true) has been invoked), then this method
opens that file using the platform encoding and returns its content. If an I/O error occurred
while reading that file, then its content is not included in the returned array.
getSelectedFiles in class JFileChooserpublic ImageReaderWriterSpi getCurrentProvider()
OPEN_DIALOG, then this method returns either null or an
instance of ImageReaderSpi. Otherwise if the dialog type has been set to SAVE_DIALOG, then this method returns either null or an instance
of ImageWriterSpi.
null if the current file filter is unknown to this method.
protected JDialog createDialog(Component parent)
throws HeadlessException
ImageFileChooser, optionally
with its ImageFileProperties pane. This method is invoked automatically by
the showDialog methods and is overridden for adding the optional
properties pane, if presents.
createDialog in class JFileChooserparent - he parent component of the dialog, or null.
HeadlessException - If the graphics environment is headlesss.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||