3261N/A * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * The <code>FileDialog</code> class displays a dialog window 0N/A * from which the user can select a file. 0N/A * Since it is a modal dialog, when the application calls 0N/A * its <code>show</code> method to display the dialog, 0N/A * it blocks the rest of the application until the user has 0N/A * @author Sami Shaio 0N/A * @author Arthur van Hoff 0N/A * This constant value indicates that the purpose of the file 0N/A * dialog window is to locate a file from which to read. 0N/A * This constant value indicates that the purpose of the file 0N/A * dialog window is to locate a file to which to write. 0N/A * There are two <code>FileDialog</code> modes: <code>LOAD</code> and 0N/A * <code>SAVE</code>. 0N/A * This integer will represent one or the other. 0N/A * If the mode is not specified it will default to <code>LOAD</code>. 0N/A * @see java.awt.FileDialog#LOAD 0N/A * @see java.awt.FileDialog#SAVE 0N/A * The string specifying the directory to display 0N/A * in the file dialog. This variable may be <code>null</code>. 0N/A * @see getDirectory() 0N/A * @see setDirectory() 0N/A * The string specifying the initial value of the 0N/A * filename text field in the file dialog. 0N/A * This variable may be <code>null</code>. 2153N/A * Contains the File instances for all the files that the user selects. 2153N/A * Represents whether the file dialog allows the multiple file selection. 0N/A * The filter used as the file dialog's filename filter. 0N/A * The file dialog will only be displaying files whose 0N/A * names are accepted by this filter. 0N/A * This variable may be <code>null</code>. 0N/A * @see #getFilenameFilter() 0N/A * @see #setFilenameFilter() 0N/A * @see FileNameFilter 0N/A * JDK 1.1 serialVersionUID 0N/A /* ensure that the necessary native libraries are loaded */ 0N/A * Initialize JNI field and method IDs for fields that may be 0N/A * Creates a file dialog for loading a file. The title of the 0N/A * file dialog is initially empty. This is a convenience method for 0N/A * <code>FileDialog(parent, "", LOAD)</code>. 0N/A * @param parent the owner of the dialog 0N/A * Creates a file dialog window with the specified title for loading 0N/A * a file. The files shown are those in the current directory. 0N/A * This is a convenience method for 0N/A * <code>FileDialog(parent, title, LOAD)</code>. 0N/A * @param parent the owner of the dialog 0N/A * @param title the title of the dialog 0N/A * Creates a file dialog window with the specified title for loading 0N/A * If the value of <code>mode</code> is <code>LOAD</code>, then the 0N/A * file dialog is finding a file to read, and the files shown are those 0N/A * in the current directory. If the value of 0N/A * <code>mode</code> is <code>SAVE</code>, the file dialog is finding 0N/A * a place to write a file. 0N/A * @param parent the owner of the dialog 0N/A * @param title the title of the dialog 0N/A * @param mode the mode of the dialog; either 0N/A * <code>FileDialog.LOAD</code> or <code>FileDialog.SAVE</code> 0N/A * @exception IllegalArgumentException if an illegal file 0N/A * dialog mode is supplied 0N/A * @see java.awt.FileDialog#LOAD 0N/A * @see java.awt.FileDialog#SAVE 0N/A * Creates a file dialog for loading a file. The title of the 0N/A * file dialog is initially empty. This is a convenience method for 0N/A * <code>FileDialog(parent, "", LOAD)</code>. 0N/A * @param parent the owner of the dialog 0N/A * @exception java.lang.IllegalArgumentException if the <code>parent</code>'s 0N/A * <code>GraphicsConfiguration</code> 0N/A * is not from a screen device; 0N/A * @exception java.lang.IllegalArgumentException if <code>parent</code> 0N/A * is <code>null</code>; this exception is always thrown when 0N/A * <code>GraphicsEnvironment.isHeadless</code> 0N/A * returns <code>true</code> 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * Creates a file dialog window with the specified title for loading 0N/A * a file. The files shown are those in the current directory. 0N/A * This is a convenience method for 0N/A * <code>FileDialog(parent, title, LOAD)</code>. 0N/A * @param parent the owner of the dialog 0N/A * @param title the title of the dialog; a <code>null</code> value 0N/A * will be accepted without causing a 0N/A * <code>NullPointerException</code> to be thrown 0N/A * @exception java.lang.IllegalArgumentException if the <code>parent</code>'s 0N/A * <code>GraphicsConfiguration</code> 0N/A * is not from a screen device; 0N/A * @exception java.lang.IllegalArgumentException if <code>parent</code> 0N/A * is <code>null</code>; this exception is always thrown when 0N/A * <code>GraphicsEnvironment.isHeadless</code> 0N/A * returns <code>true</code> 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * Creates a file dialog window with the specified title for loading 0N/A * If the value of <code>mode</code> is <code>LOAD</code>, then the 0N/A * file dialog is finding a file to read, and the files shown are those 0N/A * in the current directory. If the value of 0N/A * <code>mode</code> is <code>SAVE</code>, the file dialog is finding 0N/A * a place to write a file. 0N/A * @param parent the owner of the dialog 0N/A * @param title the title of the dialog; a <code>null</code> value 0N/A * will be accepted without causing a 0N/A * <code>NullPointerException</code> to be thrown 0N/A * @param mode the mode of the dialog; either 0N/A * <code>FileDialog.LOAD</code> or <code>FileDialog.SAVE</code> 0N/A * @exception java.lang.IllegalArgumentException if an illegal 0N/A * file dialog mode is supplied; 0N/A * @exception java.lang.IllegalArgumentException if the <code>parent</code>'s 0N/A * <code>GraphicsConfiguration</code> 0N/A * is not from a screen device; 0N/A * @exception java.lang.IllegalArgumentException if <code>parent</code> 0N/A * is <code>null</code>; this exception is always thrown when 0N/A * <code>GraphicsEnvironment.isHeadless</code> 0N/A * returns <code>true</code> 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * @see java.awt.FileDialog#LOAD 0N/A * @see java.awt.FileDialog#SAVE 0N/A * Constructs a name for this component. Called by <code>getName()</code> 0N/A * when the name is <code>null</code>. 0N/A * Creates the file dialog's peer. The peer allows us to change the look 0N/A * of the file dialog without changing its functionality. 0N/A * Indicates whether this file dialog box is for loading from a file 0N/A * or for saving to a file. 0N/A * @return the mode of this file dialog window, either 0N/A * <code>FileDialog.LOAD</code> or 0N/A * <code>FileDialog.SAVE</code> 0N/A * @see java.awt.FileDialog#LOAD 0N/A * @see java.awt.FileDialog#SAVE 0N/A * @see java.awt.FileDialog#setMode 0N/A * Sets the mode of the file dialog. If <code>mode</code> is not 0N/A * a legal value, an exception will be thrown and <code>mode</code> 0N/A * @param mode the mode for this file dialog, either 0N/A * <code>FileDialog.LOAD</code> or 0N/A * <code>FileDialog.SAVE</code> 0N/A * @see java.awt.FileDialog#LOAD 0N/A * @see java.awt.FileDialog#SAVE 0N/A * @see java.awt.FileDialog#getMode 0N/A * @exception IllegalArgumentException if an illegal file 0N/A * dialog mode is supplied 0N/A * Gets the directory of this file dialog. 0N/A * @return the (potentially <code>null</code> or invalid) 0N/A * directory of this <code>FileDialog</code> 0N/A * @see java.awt.FileDialog#setDirectory 0N/A * Sets the directory of this file dialog window to be the 0N/A * specified directory. Specifying a <code>null</code> or an 0N/A * invalid directory implies an implementation-defined default. 0N/A * This default will not be realized, however, until the user 0N/A * has selected a file. Until this point, <code>getDirectory()</code> 0N/A * will return the value passed into this method. 0N/A * Specifying "" as the directory is exactly equivalent to 0N/A * specifying <code>null</code> as the directory. 0N/A * @param dir the specified directory 0N/A * @see java.awt.FileDialog#getDirectory 0N/A * Gets the selected file of this file dialog. If the user 0N/A * selected <code>CANCEL</code>, the returned file is <code>null</code>. 0N/A * @return the currently selected file of this file dialog window, 0N/A * or <code>null</code> if none is selected 0N/A * @see java.awt.FileDialog#setFile 2153N/A * Returns files that the user selects. 2153N/A * If the user cancels the file dialog, 2153N/A * then the method returns an empty array. 2153N/A * @return files that the user selects or an empty array 2153N/A * if the user cancels the file dialog. 2153N/A * Stores the names of all the files that the user selects. 2153N/A * Note that the method is private and it's intended to be used 2153N/A * by the peers through the AWTAccessor API. 2153N/A * @param directory the current directory 2153N/A * @param files the array that contains the short names of 2153N/A * all the files that the user selects. 0N/A * Sets the selected file for this file dialog window to be the 0N/A * specified file. This file becomes the default file if it is set 0N/A * before the file dialog window is first shown. 0N/A * Specifying "" as the file is exactly equivalent to specifying 0N/A * @param file the file being set 2153N/A * Enables or disables multiple file selection for the file dialog. 2153N/A * @param enable if {@code true}, multiple file selection is enabled; 2153N/A * {@code false} - disabled. 2153N/A * Returns whether the file dialog allows the multiple file selection. 2153N/A * @return {@code true} if the file dialog allows the multiple 2153N/A * file selection; {@code false} otherwise. 0N/A * Determines this file dialog's filename filter. A filename filter 0N/A * allows the user to specify which files appear in the file dialog 0N/A * window. Filename filters do not function in Sun's reference 0N/A * implementation for Microsoft Windows. 0N/A * @return this file dialog's filename filter 0N/A * @see java.io.FilenameFilter 0N/A * @see java.awt.FileDialog#setFilenameFilter 0N/A * Sets the filename filter for this file dialog window to the 0N/A * Filename filters do not function in Sun's reference 0N/A * implementation for Microsoft Windows. 0N/A * @param filter the specified filter 0N/A * @see java.io.FilenameFilter 0N/A * @see java.awt.FileDialog#getFilenameFilter 0N/A * Reads the <code>ObjectInputStream</code> and performs 0N/A * a backwards compatibility check by converting 0N/A * either a <code>dir</code> or a <code>file</code> 0N/A * equal to an empty string to <code>null</code>. 0N/A * @param s the <code>ObjectInputStream</code> to read 0N/A // 1.1 Compatibility: "" is not converted to null in 1.1 0N/A * Returns a string representing the state of this <code>FileDialog</code> 0N/A * window. This method is intended to be used only for debugging purposes, 0N/A * and the content and format of the returned string may vary between 0N/A * implementations. The returned string may be empty but may not be 0N/A * <code>null</code>. 0N/A * @return the parameter string of this file dialog window