< prev index next >
src/java.desktop/share/classes/javax/swing/JFileChooser.java
Print this page
*** 53,65 ****
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.lang.ref.WeakReference;
/**
! * <code>JFileChooser</code> provides a simple mechanism for the user to
* choose a file.
! * For information about using <code>JFileChooser</code>, see
* <a
href="http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html">How to Use File Choosers</a>,
* a section in <em>The Java Tutorial</em>.
*
* <p>
--- 53,65 ----
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.lang.ref.WeakReference;
/**
! * {@code JFileChooser} provides a simple mechanism for the user to
* choose a file.
! * For information about using {@code JFileChooser}, see
* <a
href="http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html">How to Use File Choosers</a>,
* a section in <em>The Java Tutorial</em>.
*
* <p>
*** 102,124 ****
// ************************
// ***** Dialog Types *****
// ************************
/**
! * Type value indicating that the <code>JFileChooser</code> supports an
* "Open" file operation.
*/
public static final int OPEN_DIALOG = 0;
/**
! * Type value indicating that the <code>JFileChooser</code> supports a
* "Save" file operation.
*/
public static final int SAVE_DIALOG = 1;
/**
! * Type value indicating that the <code>JFileChooser</code> supports a
* developer-specified file operation.
*/
public static final int CUSTOM_DIALOG = 2;
--- 102,124 ----
// ************************
// ***** Dialog Types *****
// ************************
/**
! * Type value indicating that the {@code JFileChooser} supports an
* "Open" file operation.
*/
public static final int OPEN_DIALOG = 0;
/**
! * Type value indicating that the {@code JFileChooser} supports a
* "Save" file operation.
*/
public static final int SAVE_DIALOG = 1;
/**
! * Type value indicating that the {@code JFileChooser} supports a
* developer-specified file operation.
*/
public static final int CUSTOM_DIALOG = 2;
*** 288,350 ****
// *************************************
// ***** JFileChooser Constructors *****
// *************************************
/**
! * Constructs a <code>JFileChooser</code> pointing to the user's
* default directory. This default depends on the operating system.
* It is typically the "My Documents" folder on Windows, and the
* user's home directory on Unix.
*/
public JFileChooser() {
this((File) null, (FileSystemView) null);
}
/**
! * Constructs a <code>JFileChooser</code> using the given path.
! * Passing in a <code>null</code>
* string causes the file chooser to point to the user's default directory.
* This default depends on the operating system. It is
* typically the "My Documents" folder on Windows, and the user's
* home directory on Unix.
*
! * @param currentDirectoryPath a <code>String</code> giving the path
* to a file or directory
*/
public JFileChooser(String currentDirectoryPath) {
this(currentDirectoryPath, (FileSystemView) null);
}
/**
! * Constructs a <code>JFileChooser</code> using the given <code>File</code>
! * as the path. Passing in a <code>null</code> file
* causes the file chooser to point to the user's default directory.
* This default depends on the operating system. It is
* typically the "My Documents" folder on Windows, and the user's
* home directory on Unix.
*
! * @param currentDirectory a <code>File</code> object specifying
* the path to a file or directory
*/
public JFileChooser(File currentDirectory) {
this(currentDirectory, (FileSystemView) null);
}
/**
! * Constructs a <code>JFileChooser</code> using the given
! * <code>FileSystemView</code>.
*
* @param fsv a {@code FileSystemView}
*/
public JFileChooser(FileSystemView fsv) {
this((File) null, fsv);
}
/**
! * Constructs a <code>JFileChooser</code> using the given current directory
! * and <code>FileSystemView</code>.
*
* @param currentDirectory a {@code File} object specifying the path to a
* file or directory
* @param fsv a {@code FileSystemView}
*/
--- 288,350 ----
// *************************************
// ***** JFileChooser Constructors *****
// *************************************
/**
! * Constructs a {@code JFileChooser} pointing to the user's
* default directory. This default depends on the operating system.
* It is typically the "My Documents" folder on Windows, and the
* user's home directory on Unix.
*/
public JFileChooser() {
this((File) null, (FileSystemView) null);
}
/**
! * Constructs a {@code JFileChooser} using the given path.
! * Passing in a {@code null}
* string causes the file chooser to point to the user's default directory.
* This default depends on the operating system. It is
* typically the "My Documents" folder on Windows, and the user's
* home directory on Unix.
*
! * @param currentDirectoryPath a {@code String} giving the path
* to a file or directory
*/
public JFileChooser(String currentDirectoryPath) {
this(currentDirectoryPath, (FileSystemView) null);
}
/**
! * Constructs a {@code JFileChooser} using the given {@code File}
! * as the path. Passing in a {@code null} file
* causes the file chooser to point to the user's default directory.
* This default depends on the operating system. It is
* typically the "My Documents" folder on Windows, and the user's
* home directory on Unix.
*
! * @param currentDirectory a {@code File} object specifying
* the path to a file or directory
*/
public JFileChooser(File currentDirectory) {
this(currentDirectory, (FileSystemView) null);
}
/**
! * Constructs a {@code JFileChooser} using the given
! * {@code FileSystemView}.
*
* @param fsv a {@code FileSystemView}
*/
public JFileChooser(FileSystemView fsv) {
this((File) null, fsv);
}
/**
! * Constructs a {@code JFileChooser} using the given current directory
! * and {@code FileSystemView}.
*
* @param currentDirectory a {@code File} object specifying the path to a
* file or directory
* @param fsv a {@code FileSystemView}
*/
*** 352,363 ****
setup(fsv);
setCurrentDirectory(currentDirectory);
}
/**
! * Constructs a <code>JFileChooser</code> using the given current directory
! * path and <code>FileSystemView</code>.
*
* @param currentDirectoryPath a {@code String} specifying the path to a file
* or directory
* @param fsv a {@code FileSystemView}
*/
--- 352,363 ----
setup(fsv);
setCurrentDirectory(currentDirectory);
}
/**
! * Constructs a {@code JFileChooser} using the given current directory
! * path and {@code FileSystemView}.
*
* @param currentDirectoryPath a {@code String} specifying the path to a file
* or directory
* @param fsv a {@code FileSystemView}
*/
*** 416,458 ****
tk.addPropertyChangeListener(SHOW_HIDDEN_PROP, showFilesListener);
}
}
/**
! * Sets the <code>dragEnabled</code> property,
! * which must be <code>true</code> to enable
* automatic drag handling (the first part of drag and drop)
* on this component.
! * The <code>transferHandler</code> property needs to be set
! * to a non-<code>null</code> value for the drag to do
! * anything. The default value of the <code>dragEnabled</code>
* property
! * is <code>false</code>.
*
* <p>
*
* When automatic drag handling is enabled,
* most look and feels begin a drag-and-drop operation
* whenever the user presses the mouse button over an item
* and then moves the mouse a few pixels.
! * Setting this property to <code>true</code>
* can therefore have a subtle effect on
* how selections behave.
*
* <p>
*
* Some look and feels might not support automatic drag and drop;
* they will ignore this property. You can work around such
* look and feels by modifying the component
! * to directly call the <code>exportAsDrag</code> method of a
! * <code>TransferHandler</code>.
*
! * @param b the value to set the <code>dragEnabled</code> property to
* @exception HeadlessException if
! * <code>b</code> is <code>true</code> and
! * <code>GraphicsEnvironment.isHeadless()</code>
! * returns <code>true</code>
* @see java.awt.GraphicsEnvironment#isHeadless
* @see #getDragEnabled
* @see #setTransferHandler
* @see TransferHandler
* @since 1.4
--- 416,458 ----
tk.addPropertyChangeListener(SHOW_HIDDEN_PROP, showFilesListener);
}
}
/**
! * Sets the {@code dragEnabled} property,
! * which must be {@code true} to enable
* automatic drag handling (the first part of drag and drop)
* on this component.
! * The {@code transferHandler} property needs to be set
! * to a non-{@code null} value for the drag to do
! * anything. The default value of the {@code dragEnabled}
* property
! * is {@code false}.
*
* <p>
*
* When automatic drag handling is enabled,
* most look and feels begin a drag-and-drop operation
* whenever the user presses the mouse button over an item
* and then moves the mouse a few pixels.
! * Setting this property to {@code true}
* can therefore have a subtle effect on
* how selections behave.
*
* <p>
*
* Some look and feels might not support automatic drag and drop;
* they will ignore this property. You can work around such
* look and feels by modifying the component
! * to directly call the {@code exportAsDrag} method of a
! * {@code TransferHandler}.
*
! * @param b the value to set the {@code dragEnabled} property to
* @exception HeadlessException if
! * {@code b} is {@code true} and
! * {@code GraphicsEnvironment.isHeadless()}
! * returns {@code true}
* @see java.awt.GraphicsEnvironment#isHeadless
* @see #getDragEnabled
* @see #setTransferHandler
* @see TransferHandler
* @since 1.4
*** 471,483 ****
throw new HeadlessException();
}
}
/**
! * Gets the value of the <code>dragEnabled</code> property.
*
! * @return the value of the <code>dragEnabled</code> property
* @see #setDragEnabled
* @since 1.4
*/
public boolean getDragEnabled() {
return dragEnabled;
--- 471,483 ----
throw new HeadlessException();
}
}
/**
! * Gets the value of the {@code dragEnabled} property.
*
! * @return the value of the {@code dragEnabled} property
* @see #setDragEnabled
* @since 1.4
*/
public boolean getDragEnabled() {
return dragEnabled;
*** 487,497 ****
// ****** File Operations ******
// *****************************
/**
* Returns the selected file. This can be set either by the
! * programmer via <code>setSelectedFile</code> or by a user action, such as
* either typing the filename into the UI or selecting the
* file from a list in the UI.
*
* @see #setSelectedFile
* @return the selected file
--- 487,497 ----
// ****** File Operations ******
// *****************************
/**
* Returns the selected file. This can be set either by the
! * programmer via {@code setSelectedFile} or by a user action, such as
* either typing the filename into the UI or selecting the
* file from a list in the UI.
*
* @see #setSelectedFile
* @return the selected file
*** 572,588 ****
public File getCurrentDirectory() {
return currentDirectory;
}
/**
! * Sets the current directory. Passing in <code>null</code> sets the
* file chooser to point to the user's default directory.
* This default depends on the operating system. It is
* typically the "My Documents" folder on Windows, and the user's
* home directory on Unix.
*
! * If the file passed in as <code>currentDirectory</code> is not a
* directory, the parent of the file will be used as the currentDirectory.
* If the parent is not traversable, then it will walk up the parent tree
* until it finds a traversable directory, or hits the root of the
* file system.
*
--- 572,588 ----
public File getCurrentDirectory() {
return currentDirectory;
}
/**
! * Sets the current directory. Passing in {@code null} sets the
* file chooser to point to the user's default directory.
* This default depends on the operating system. It is
* typically the "My Documents" folder on Windows, and the user's
* home directory on Unix.
*
! * If the file passed in as {@code currentDirectory} is not a
* directory, the parent of the file will be used as the currentDirectory.
* If the parent is not traversable, then it will walk up the parent tree
* until it finds a traversable directory, or hits the root of the
* file system.
*
*** 657,668 ****
* Pops up an "Open File" file chooser dialog. Note that the
* text that appears in the approve button is determined by
* the L&F.
*
* @param parent the parent component of the dialog,
! * can be <code>null</code>;
! * see <code>showDialog</code> for details
* @return the return state of the file chooser on popdown:
* <ul>
* <li>JFileChooser.CANCEL_OPTION
* <li>JFileChooser.APPROVE_OPTION
* <li>JFileChooser.ERROR_OPTION if an error occurs or the
--- 657,668 ----
* Pops up an "Open File" file chooser dialog. Note that the
* text that appears in the approve button is determined by
* the L&F.
*
* @param parent the parent component of the dialog,
! * can be {@code null};
! * see {@code showDialog} for details
* @return the return state of the file chooser on popdown:
* <ul>
* <li>JFileChooser.CANCEL_OPTION
* <li>JFileChooser.APPROVE_OPTION
* <li>JFileChooser.ERROR_OPTION if an error occurs or the
*** 682,693 ****
* Pops up a "Save File" file chooser dialog. Note that the
* text that appears in the approve button is determined by
* the L&F.
*
* @param parent the parent component of the dialog,
! * can be <code>null</code>;
! * see <code>showDialog</code> for details
* @return the return state of the file chooser on popdown:
* <ul>
* <li>JFileChooser.CANCEL_OPTION
* <li>JFileChooser.APPROVE_OPTION
* <li>JFileChooser.ERROR_OPTION if an error occurs or the
--- 682,693 ----
* Pops up a "Save File" file chooser dialog. Note that the
* text that appears in the approve button is determined by
* the L&F.
*
* @param parent the parent component of the dialog,
! * can be {@code null};
! * see {@code showDialog} for details
* @return the return state of the file chooser on popdown:
* <ul>
* <li>JFileChooser.CANCEL_OPTION
* <li>JFileChooser.APPROVE_OPTION
* <li>JFileChooser.ERROR_OPTION if an error occurs or the
*** 724,753 ****
* <!--PENDING(kwalrath) - should specify modality and what
* "depends" means.-->
*
* <p>
*
! * The <code>parent</code> argument determines two things:
* the frame on which the open dialog depends and
* the component whose position the look and feel
* should consider when placing the dialog. If the parent
! * is a <code>Frame</code> object (such as a <code>JFrame</code>)
* then the dialog depends on the frame and
* the look and feel positions the dialog
* relative to the frame (for example, centered over the frame).
* If the parent is a component, then the dialog
* depends on the frame containing the component,
* and is positioned relative to the component
* (for example, centered over the component).
! * If the parent is <code>null</code>, then the dialog depends on
* no visible window, and it's placed in a
* look-and-feel-dependent position
* such as the center of the screen.
*
* @param parent the parent component of the dialog;
! * can be <code>null</code>
! * @param approveButtonText the text of the <code>ApproveButton</code>
* @return the return state of the file chooser on popdown:
* <ul>
* <li>JFileChooser.CANCEL_OPTION
* <li>JFileChooser.APPROVE_OPTION
* <li>JFileChooser.ERROR_OPTION if an error occurs or the
--- 724,753 ----
* <!--PENDING(kwalrath) - should specify modality and what
* "depends" means.-->
*
* <p>
*
! * The {@code parent} argument determines two things:
* the frame on which the open dialog depends and
* the component whose position the look and feel
* should consider when placing the dialog. If the parent
! * is a {@code Frame} object (such as a {@code JFrame})
* then the dialog depends on the frame and
* the look and feel positions the dialog
* relative to the frame (for example, centered over the frame).
* If the parent is a component, then the dialog
* depends on the frame containing the component,
* and is positioned relative to the component
* (for example, centered over the component).
! * If the parent is {@code null}, then the dialog depends on
* no visible window, and it's placed in a
* look-and-feel-dependent position
* such as the center of the screen.
*
* @param parent the parent component of the dialog;
! * can be {@code null}
! * @param approveButtonText the text of the {@code ApproveButton}
* @return the return state of the file chooser on popdown:
* <ul>
* <li>JFileChooser.CANCEL_OPTION
* <li>JFileChooser.APPROVE_OPTION
* <li>JFileChooser.ERROR_OPTION if an error occurs or the
*** 789,801 ****
dialog = null;
return returnValue;
}
/**
! * Creates and returns a new <code>JDialog</code> wrapping
! * <code>this</code> centered on the <code>parent</code>
! * in the <code>parent</code>'s frame.
* This method can be overriden to further manipulate the dialog,
* to disable resizing, set the location, etc. Example:
* <pre>
* class MyFileChooser extends JFileChooser {
* protected JDialog createDialog(Component parent) throws HeadlessException {
--- 789,801 ----
dialog = null;
return returnValue;
}
/**
! * Creates and returns a new {@code JDialog} wrapping
! * {@code this} centered on the {@code parent}
! * in the {@code parent}'s frame.
* This method can be overriden to further manipulate the dialog,
* to disable resizing, set the location, etc. Example:
* <pre>
* class MyFileChooser extends JFileChooser {
* protected JDialog createDialog(Component parent) throws HeadlessException {
*** 806,817 ****
* }
* }
* </pre>
*
* @param parent the parent component of the dialog;
! * can be <code>null</code>
! * @return a new <code>JDialog</code> containing this instance
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true.
* @see java.awt.GraphicsEnvironment#isHeadless
* @since 1.4
*/
--- 806,817 ----
* }
* }
* </pre>
*
* @param parent the parent component of the dialog;
! * can be {@code null}
! * @return a new {@code JDialog} containing this instance
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true.
* @see java.awt.GraphicsEnvironment#isHeadless
* @since 1.4
*/
*** 850,863 ****
// **************************
// ***** Dialog Options *****
// **************************
/**
! * Returns the value of the <code>controlButtonsAreShown</code>
* property.
*
! * @return the value of the <code>controlButtonsAreShown</code>
* property
*
* @see #setControlButtonsAreShown
* @since 1.3
*/
--- 850,863 ----
// **************************
// ***** Dialog Options *****
// **************************
/**
! * Returns the value of the {@code controlButtonsAreShown}
* property.
*
! * @return the value of the {@code controlButtonsAreShown}
* property
*
* @see #setControlButtonsAreShown
* @since 1.3
*/
*** 868,887 ****
/**
* Sets the property
* that indicates whether the <i>approve</i> and <i>cancel</i>
* buttons are shown in the file chooser. This property
! * is <code>true</code> by default. Look and feels
* that always show these buttons will ignore the value
* of this property.
* This method fires a property-changed event,
* using the string value of
! * <code>CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY</code>
* as the name of the property.
*
! * @param b <code>false</code> if control buttons should not be
! * shown; otherwise, <code>true</code>
*
* @beaninfo
* preferred: true
* bound: true
* description: Sets whether the approve & cancel buttons are shown.
--- 868,887 ----
/**
* Sets the property
* that indicates whether the <i>approve</i> and <i>cancel</i>
* buttons are shown in the file chooser. This property
! * is {@code true} by default. Look and feels
* that always show these buttons will ignore the value
* of this property.
* This method fires a property-changed event,
* using the string value of
! * {@code CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY}
* as the name of the property.
*
! * @param b {@code false} if control buttons should not be
! * shown; otherwise, {@code true}
*
* @beaninfo
* preferred: true
* bound: true
* description: Sets whether the approve & cancel buttons are shown.
*** 899,909 ****
firePropertyChange(CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY, oldValue, controlsShown);
}
/**
* Returns the type of this dialog. The default is
! * <code>JFileChooser.OPEN_DIALOG</code>.
*
* @return the type of dialog to be displayed:
* <ul>
* <li>JFileChooser.OPEN_DIALOG
* <li>JFileChooser.SAVE_DIALOG
--- 899,909 ----
firePropertyChange(CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY, oldValue, controlsShown);
}
/**
* Returns the type of this dialog. The default is
! * {@code JFileChooser.OPEN_DIALOG}.
*
* @return the type of dialog to be displayed:
* <ul>
* <li>JFileChooser.OPEN_DIALOG
* <li>JFileChooser.SAVE_DIALOG
*** 915,945 ****
public int getDialogType() {
return dialogType;
}
/**
! * Sets the type of this dialog. Use <code>OPEN_DIALOG</code> when you
* want to bring up a file chooser that the user can use to open a file.
! * Likewise, use <code>SAVE_DIALOG</code> for letting the user choose
* a file for saving.
! * Use <code>CUSTOM_DIALOG</code> when you want to use the file
* chooser in a context other than "Open" or "Save".
* For instance, you might want to bring up a file chooser that allows
* the user to choose a file to execute. Note that you normally would not
! * need to set the <code>JFileChooser</code> to use
! * <code>CUSTOM_DIALOG</code>
! * since a call to <code>setApproveButtonText</code> does this for you.
! * The default dialog type is <code>JFileChooser.OPEN_DIALOG</code>.
*
* @param dialogType the type of dialog to be displayed:
* <ul>
* <li>JFileChooser.OPEN_DIALOG
* <li>JFileChooser.SAVE_DIALOG
* <li>JFileChooser.CUSTOM_DIALOG
* </ul>
*
! * @exception IllegalArgumentException if <code>dialogType</code> is
* not legal
* @beaninfo
* preferred: true
* bound: true
* description: The type (open, save, custom) of the JFileChooser.
--- 915,945 ----
public int getDialogType() {
return dialogType;
}
/**
! * Sets the type of this dialog. Use {@code OPEN_DIALOG} when you
* want to bring up a file chooser that the user can use to open a file.
! * Likewise, use {@code SAVE_DIALOG} for letting the user choose
* a file for saving.
! * Use {@code CUSTOM_DIALOG} when you want to use the file
* chooser in a context other than "Open" or "Save".
* For instance, you might want to bring up a file chooser that allows
* the user to choose a file to execute. Note that you normally would not
! * need to set the {@code JFileChooser} to use
! * {@code CUSTOM_DIALOG}
! * since a call to {@code setApproveButtonText} does this for you.
! * The default dialog type is {@code JFileChooser.OPEN_DIALOG}.
*
* @param dialogType the type of dialog to be displayed:
* <ul>
* <li>JFileChooser.OPEN_DIALOG
* <li>JFileChooser.SAVE_DIALOG
* <li>JFileChooser.CUSTOM_DIALOG
* </ul>
*
! * @exception IllegalArgumentException if {@code dialogType} is
* not legal
* @beaninfo
* preferred: true
* bound: true
* description: The type (open, save, custom) of the JFileChooser.
*** 972,985 ****
"Incorrect Dialog Type: " + dialogType);
}
}
/**
! * Sets the string that goes in the <code>JFileChooser</code> window's
* title bar.
*
! * @param dialogTitle the new <code>String</code> for the title bar
*
* @beaninfo
* preferred: true
* bound: true
* description: The title of the JFileChooser dialog window.
--- 972,985 ----
"Incorrect Dialog Type: " + dialogType);
}
}
/**
! * Sets the string that goes in the {@code JFileChooser} window's
* title bar.
*
! * @param dialogTitle the new {@code String} for the title bar
*
* @beaninfo
* preferred: true
* bound: true
* description: The title of the JFileChooser dialog window.
*** 995,1005 ****
}
firePropertyChange(DIALOG_TITLE_CHANGED_PROPERTY, oldValue, dialogTitle);
}
/**
! * Gets the string that goes in the <code>JFileChooser</code>'s titlebar.
*
* @return the string from the {@code JFileChooser} window's title bar
* @see #setDialogTitle
*/
public String getDialogTitle() {
--- 995,1005 ----
}
firePropertyChange(DIALOG_TITLE_CHANGED_PROPERTY, oldValue, dialogTitle);
}
/**
! * Gets the string that goes in the {@code JFileChooser}'s titlebar.
*
* @return the string from the {@code JFileChooser} window's title bar
* @see #setDialogTitle
*/
public String getDialogTitle() {
*** 1011,1022 ****
// ************************************
/**
! * Sets the tooltip text used in the <code>ApproveButton</code>.
! * If <code>null</code>, the UI object will determine the button's text.
*
* @beaninfo
* preferred: true
* bound: true
* description: The tooltip text for the ApproveButton.
--- 1011,1022 ----
// ************************************
/**
! * Sets the tooltip text used in the {@code ApproveButton}.
! * If {@code null}, the UI object will determine the button's text.
*
* @beaninfo
* preferred: true
* bound: true
* description: The tooltip text for the ApproveButton.
*** 1035,1046 ****
firePropertyChange(APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY, oldValue, approveButtonToolTipText);
}
/**
! * Returns the tooltip text used in the <code>ApproveButton</code>.
! * If <code>null</code>, the UI object will determine the button's text.
*
* @return the tooltip text used for the approve button
*
* @see #setApproveButtonText
* @see #setDialogType
--- 1035,1046 ----
firePropertyChange(APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY, oldValue, approveButtonToolTipText);
}
/**
! * Returns the tooltip text used in the {@code ApproveButton}.
! * If {@code null}, the UI object will determine the button's text.
*
* @return the tooltip text used for the approve button
*
* @see #setApproveButtonText
* @see #setDialogType
*** 1095,1113 ****
setApproveButtonMnemonic(vk);
}
/**
! * Sets the text used in the <code>ApproveButton</code> in the
! * <code>FileChooserUI</code>.
*
* @beaninfo
* preferred: true
* bound: true
* description: The text that goes in the ApproveButton.
*
! * @param approveButtonText the text used in the <code>ApproveButton</code>
*
* @see #getApproveButtonText
* @see #setDialogType
* @see #showDialog
*/
--- 1095,1113 ----
setApproveButtonMnemonic(vk);
}
/**
! * Sets the text used in the {@code ApproveButton} in the
! * {@code FileChooserUI}.
*
* @beaninfo
* preferred: true
* bound: true
* description: The text that goes in the ApproveButton.
*
! * @param approveButtonText the text used in the {@code ApproveButton}
*
* @see #getApproveButtonText
* @see #setDialogType
* @see #showDialog
*/
*** 1120,1136 ****
this.approveButtonText = approveButtonText;
firePropertyChange(APPROVE_BUTTON_TEXT_CHANGED_PROPERTY, oldValue, approveButtonText);
}
/**
! * Returns the text used in the <code>ApproveButton</code> in the
! * <code>FileChooserUI</code>.
! * If <code>null</code>, the UI object will determine the button's text.
*
* Typically, this would be "Open" or "Save".
*
! * @return the text used in the <code>ApproveButton</code>
*
* @see #setApproveButtonText
* @see #setDialogType
* @see #showDialog
*/
--- 1120,1136 ----
this.approveButtonText = approveButtonText;
firePropertyChange(APPROVE_BUTTON_TEXT_CHANGED_PROPERTY, oldValue, approveButtonText);
}
/**
! * Returns the text used in the {@code ApproveButton} in the
! * {@code FileChooserUI}.
! * If {@code null}, the UI object will determine the button's text.
*
* Typically, this would be "Open" or "Save".
*
! * @return the text used in the {@code ApproveButton}
*
* @see #setApproveButtonText
* @see #setDialogType
* @see #showDialog
*/
*** 1139,1149 ****
}
/**
* Gets the list of user choosable file filters.
*
! * @return a <code>FileFilter</code> array containing all the choosable
* file filters
*
* @see #addChoosableFileFilter
* @see #removeChoosableFileFilter
* @see #resetChoosableFileFilters
--- 1139,1149 ----
}
/**
* Gets the list of user choosable file filters.
*
! * @return a {@code FileFilter} array containing all the choosable
* file filters
*
* @see #addChoosableFileFilter
* @see #removeChoosableFileFilter
* @see #resetChoosableFileFilters
*** 1157,1167 ****
/**
* Adds a filter to the list of user choosable file filters.
* For information on setting the file selection mode, see
* {@link #setFileSelectionMode setFileSelectionMode}.
*
! * @param filter the <code>FileFilter</code> to add to the choosable file
* filter list
*
* @beaninfo
* preferred: true
* bound: true
--- 1157,1167 ----
/**
* Adds a filter to the list of user choosable file filters.
* For information on setting the file selection mode, see
* {@link #setFileSelectionMode setFileSelectionMode}.
*
! * @param filter the {@code FileFilter} to add to the choosable file
* filter list
*
* @beaninfo
* preferred: true
* bound: true
*** 1225,1235 ****
}
/**
* Resets the choosable file filter list to its starting state. Normally,
* this removes all added file filters while leaving the
! * <code>AcceptAll</code> file filter.
*
* @see #addChoosableFileFilter
* @see #getChoosableFileFilters
* @see #removeChoosableFileFilter
*/
--- 1225,1235 ----
}
/**
* Resets the choosable file filter list to its starting state. Normally,
* this removes all added file filters while leaving the
! * {@code AcceptAll} file filter.
*
* @see #addChoosableFileFilter
* @see #getChoosableFileFilters
* @see #removeChoosableFileFilter
*/
*** 1242,1252 ****
}
firePropertyChange(CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY, oldValue, getChoosableFileFilters());
}
/**
! * Returns the <code>AcceptAll</code> file filter.
* For example, on Microsoft Windows this would be All Files (*.*).
*
* @return the {@code AcceptAll} file filter
*/
public FileFilter getAcceptAllFileFilter() {
--- 1242,1252 ----
}
firePropertyChange(CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY, oldValue, getChoosableFileFilters());
}
/**
! * Returns the {@code AcceptAll} file filter.
* For example, on Microsoft Windows this would be All Files (*.*).
*
* @return the {@code AcceptAll} file filter
*/
public FileFilter getAcceptAllFileFilter() {
*** 1256,1280 ****
}
return filter;
}
/**
! * Returns whether the <code>AcceptAll FileFilter</code> is used.
! * @return true if the <code>AcceptAll FileFilter</code> is used
* @see #setAcceptAllFileFilterUsed
* @since 1.3
*/
public boolean isAcceptAllFileFilterUsed() {
return useAcceptAllFileFilter;
}
/**
! * Determines whether the <code>AcceptAll FileFilter</code> is used
* as an available choice in the choosable filter list.
! * If false, the <code>AcceptAll</code> file filter is removed from
* the list of available file filters.
! * If true, the <code>AcceptAll</code> file filter will become the
* actively used file filter.
*
* @param b a {@code boolean} which determines whether the {@code AcceptAll}
* file filter is an available choice in the choosable filter list
* @beaninfo
--- 1256,1280 ----
}
return filter;
}
/**
! * Returns whether the {@code AcceptAll FileFilter} is used.
! * @return true if the {@code AcceptAll FileFilter} is used
* @see #setAcceptAllFileFilterUsed
* @since 1.3
*/
public boolean isAcceptAllFileFilterUsed() {
return useAcceptAllFileFilter;
}
/**
! * Determines whether the {@code AcceptAll FileFilter} is used
* as an available choice in the choosable filter list.
! * If false, the {@code AcceptAll} file filter is removed from
* the list of available file filters.
! * If true, the {@code AcceptAll} file filter will become the
* actively used file filter.
*
* @param b a {@code boolean} which determines whether the {@code AcceptAll}
* file filter is an available choice in the choosable filter list
* @beaninfo
*** 1330,1352 ****
accessory = newAccessory;
firePropertyChange(ACCESSORY_CHANGED_PROPERTY, oldValue, accessory);
}
/**
! * Sets the <code>JFileChooser</code> to allow the user to just
* select files, just select
* directories, or select both files and directories. The default is
! * <code>JFilesChooser.FILES_ONLY</code>.
*
* @param mode the type of files to be displayed:
* <ul>
* <li>JFileChooser.FILES_ONLY
* <li>JFileChooser.DIRECTORIES_ONLY
* <li>JFileChooser.FILES_AND_DIRECTORIES
* </ul>
*
! * @exception IllegalArgumentException if <code>mode</code> is an
* illegal file selection mode
* @beaninfo
* preferred: true
* bound: true
* description: Sets the types of files that the JFileChooser can choose.
--- 1330,1352 ----
accessory = newAccessory;
firePropertyChange(ACCESSORY_CHANGED_PROPERTY, oldValue, accessory);
}
/**
! * Sets the {@code JFileChooser} to allow the user to just
* select files, just select
* directories, or select both files and directories. The default is
! * {@code JFilesChooser.FILES_ONLY}.
*
* @param mode the type of files to be displayed:
* <ul>
* <li>JFileChooser.FILES_ONLY
* <li>JFileChooser.DIRECTORIES_ONLY
* <li>JFileChooser.FILES_AND_DIRECTORIES
* </ul>
*
! * @exception IllegalArgumentException if {@code mode} is an
* illegal file selection mode
* @beaninfo
* preferred: true
* bound: true
* description: Sets the types of files that the JFileChooser can choose.
*** 1376,1386 ****
}
}
/**
* Returns the current file-selection mode. The default is
! * <code>JFilesChooser.FILES_ONLY</code>.
*
* @return the type of files to be displayed, one of the following:
* <ul>
* <li>JFileChooser.FILES_ONLY
* <li>JFileChooser.DIRECTORIES_ONLY
--- 1376,1386 ----
}
}
/**
* Returns the current file-selection mode. The default is
! * {@code JFilesChooser.FILES_ONLY}.
*
* @return the type of files to be displayed, one of the following:
* <ul>
* <li>JFileChooser.FILES_ONLY
* <li>JFileChooser.DIRECTORIES_ONLY
*** 1457,1467 ****
}
/**
* Sets file hiding on or off. If true, hidden files are not shown
* in the file chooser. The job of determining which files are
! * shown is done by the <code>FileView</code>.
*
* @beaninfo
* preferred: true
* bound: true
* description: Sets file hiding on or off.
--- 1457,1467 ----
}
/**
* Sets file hiding on or off. If true, hidden files are not shown
* in the file chooser. The job of determining which files are
! * shown is done by the {@code FileView}.
*
* @beaninfo
* preferred: true
* bound: true
* description: Sets file hiding on or off.
*** 1566,1578 ****
// (or there is now client defined fileView) then calls the
// UI's default fileView.
/**
* Returns the filename.
! * @param f the <code>File</code>
! * @return the <code>String</code> containing the filename for
! * <code>f</code>
* @see FileView#getName
*/
public String getName(File f) {
String filename = null;
if(f != null) {
--- 1566,1578 ----
// (or there is now client defined fileView) then calls the
// UI's default fileView.
/**
* Returns the filename.
! * @param f the {@code File}
! * @return the {@code String} containing the filename for
! * {@code f}
* @see FileView#getName
*/
public String getName(File f) {
String filename = null;
if(f != null) {
*** 1589,1601 ****
return filename;
}
/**
* Returns the file description.
! * @param f the <code>File</code>
! * @return the <code>String</code> containing the file description for
! * <code>f</code>
* @see FileView#getDescription
*/
public String getDescription(File f) {
String description = null;
if(f != null) {
--- 1589,1601 ----
return filename;
}
/**
* Returns the file description.
! * @param f the {@code File}
! * @return the {@code String} containing the file description for
! * {@code f}
* @see FileView#getDescription
*/
public String getDescription(File f) {
String description = null;
if(f != null) {
*** 1612,1624 ****
return description;
}
/**
* Returns the file type.
! * @param f the <code>File</code>
! * @return the <code>String</code> containing the file type description for
! * <code>f</code>
* @see FileView#getTypeDescription
*/
public String getTypeDescription(File f) {
String typeDescription = null;
if(f != null) {
--- 1612,1624 ----
return description;
}
/**
* Returns the file type.
! * @param f the {@code File}
! * @return the {@code String} containing the file type description for
! * {@code f}
* @see FileView#getTypeDescription
*/
public String getTypeDescription(File f) {
String typeDescription = null;
if(f != null) {
*** 1636,1647 ****
}
/**
* Returns the icon for this file or type of file, depending
* on the system.
! * @param f the <code>File</code>
! * @return the <code>Icon</code> for this file, or type of file
* @see FileView#getIcon
*/
public Icon getIcon(File f) {
Icon icon = null;
if (f != null) {
--- 1636,1647 ----
}
/**
* Returns the icon for this file or type of file, depending
* on the system.
! * @param f the {@code File}
! * @return the {@code Icon} for this file, or type of file
* @see FileView#getIcon
*/
public Icon getIcon(File f) {
Icon icon = null;
if (f != null) {
*** 1659,1669 ****
}
/**
* Returns true if the file (directory) can be visited.
* Returns false if the directory cannot be traversed.
! * @param f the <code>File</code>
* @return true if the file/directory can be traversed, otherwise false
* @see FileView#isTraversable
*/
public boolean isTraversable(File f) {
Boolean traversable = null;
--- 1659,1669 ----
}
/**
* Returns true if the file (directory) can be visited.
* Returns false if the directory cannot be traversed.
! * @param f the {@code File}
* @return true if the file/directory can be traversed, otherwise false
* @see FileView#isTraversable
*/
public boolean isTraversable(File f) {
Boolean traversable = null;
*** 1684,1694 ****
return (traversable != null && traversable.booleanValue());
}
/**
* Returns true if the file should be displayed.
! * @param f the <code>File</code>
* @return true if the file should be displayed, otherwise false
* @see FileFilter#accept
*/
public boolean accept(File f) {
boolean shown = true;
--- 1684,1694 ----
return (traversable != null && traversable.booleanValue());
}
/**
* Returns true if the file should be displayed.
! * @param f the {@code File}
* @return true if the file should be displayed, otherwise false
* @see FileFilter#accept
*/
public boolean accept(File f) {
boolean shown = true;
*** 1697,1710 ****
}
return shown;
}
/**
! * Sets the file system view that the <code>JFileChooser</code> uses for
* accessing and creating file system resources, such as finding
* the floppy drive and getting a list of root drives.
! * @param fsv the new <code>FileSystemView</code>
*
* @beaninfo
* expert: true
* bound: true
* description: Sets the FileSytemView used to get filesystem information.
--- 1697,1710 ----
}
return shown;
}
/**
! * Sets the file system view that the {@code JFileChooser} uses for
* accessing and creating file system resources, such as finding
* the floppy drive and getting a list of root drives.
! * @param fsv the new {@code FileSystemView}
*
* @beaninfo
* expert: true
* bound: true
* description: Sets the FileSytemView used to get filesystem information.
*** 1717,1727 ****
firePropertyChange(FILE_SYSTEM_VIEW_CHANGED_PROPERTY, oldValue, fileSystemView);
}
/**
* Returns the file system view.
! * @return the <code>FileSystemView</code> object
* @see #setFileSystemView
*/
public FileSystemView getFileSystemView() {
return fileSystemView;
}
--- 1717,1727 ----
firePropertyChange(FILE_SYSTEM_VIEW_CHANGED_PROPERTY, oldValue, fileSystemView);
}
/**
* Returns the file system view.
! * @return the {@code FileSystemView} object
* @see #setFileSystemView
*/
public FileSystemView getFileSystemView() {
return fileSystemView;
}
*** 1734,1744 ****
* Called by the UI when the user hits the Approve button
* (labeled "Open" or "Save", by default). This can also be
* called by the programmer.
* This method causes an action event to fire
* with the command string equal to
! * <code>APPROVE_SELECTION</code>.
*
* @see #APPROVE_SELECTION
*/
public void approveSelection() {
returnValue = APPROVE_OPTION;
--- 1734,1744 ----
* Called by the UI when the user hits the Approve button
* (labeled "Open" or "Save", by default). This can also be
* called by the programmer.
* This method causes an action event to fire
* with the command string equal to
! * {@code APPROVE_SELECTION}.
*
* @see #APPROVE_SELECTION
*/
public void approveSelection() {
returnValue = APPROVE_OPTION;
*** 1751,1761 ****
/**
* Called by the UI when the user chooses the Cancel button.
* This can also be called by the programmer.
* This method causes an action event to fire
* with the command string equal to
! * <code>CANCEL_SELECTION</code>.
*
* @see #CANCEL_SELECTION
*/
public void cancelSelection() {
returnValue = CANCEL_OPTION;
--- 1751,1761 ----
/**
* Called by the UI when the user chooses the Cancel button.
* This can also be called by the programmer.
* This method causes an action event to fire
* with the command string equal to
! * {@code CANCEL_SELECTION}.
*
* @see #CANCEL_SELECTION
*/
public void cancelSelection() {
returnValue = CANCEL_OPTION;
*** 1764,1774 ****
}
fireActionPerformed(CANCEL_SELECTION);
}
/**
! * Adds an <code>ActionListener</code> to the file chooser.
*
* @param l the listener to be added
*
* @see #approveSelection
* @see #cancelSelection
--- 1764,1774 ----
}
fireActionPerformed(CANCEL_SELECTION);
}
/**
! * Adds an {@code ActionListener} to the file chooser.
*
* @param l the listener to be added
*
* @see #approveSelection
* @see #cancelSelection
*** 1776,1786 ****
public void addActionListener(ActionListener l) {
listenerList.add(ActionListener.class, l);
}
/**
! * Removes an <code>ActionListener</code> from the file chooser.
*
* @param l the listener to be removed
*
* @see #addActionListener
*/
--- 1776,1786 ----
public void addActionListener(ActionListener l) {
listenerList.add(ActionListener.class, l);
}
/**
! * Removes an {@code ActionListener} from the file chooser.
*
* @param l the listener to be removed
*
* @see #addActionListener
*/
*** 1790,1800 ****
/**
* Returns an array of all the action listeners
* registered on this file chooser.
*
! * @return all of this file chooser's <code>ActionListener</code>s
* or an empty
* array if no action listeners are currently registered
*
* @see #addActionListener
* @see #removeActionListener
--- 1790,1800 ----
/**
* Returns an array of all the action listeners
* registered on this file chooser.
*
! * @return all of this file chooser's {@code ActionListener}s
* or an empty
* array if no action listeners are currently registered
*
* @see #addActionListener
* @see #removeActionListener
*** 1806,1816 ****
}
/**
* Notifies all listeners that have registered interest for
* notification on this event type. The event instance
! * is lazily created using the <code>command</code> parameter.
*
* @param command a string that may specify a command associated with
* the event
* @see EventListenerList
*/
--- 1806,1816 ----
}
/**
* Notifies all listeners that have registered interest for
* notification on this event type. The event instance
! * is lazily created using the {@code command} parameter.
*
* @param command a string that may specify a command associated with
* the event
* @see EventListenerList
*/
*** 1911,1922 ****
public FileChooserUI getUI() {
return (FileChooserUI) ui;
}
/**
! * See <code>readObject</code> and <code>writeObject</code> in
! * <code>JComponent</code> for more
* information about serialization in Swing.
*/
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException {
ObjectInputStream.GetField f = in.readFields();
--- 1911,1922 ----
public FileChooserUI getUI() {
return (FileChooserUI) ui;
}
/**
! * See {@code readObject} and {@code writeObject} in
! * {@code JComponent} for more
* information about serialization in Swing.
*/
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException {
ObjectInputStream.GetField f = in.readFields();
*** 1958,1969 ****
installShowFilesListener();
}
/**
! * See <code>readObject</code> and <code>writeObject</code> in
! * <code>JComponent</code> for more
* information about serialization in Swing.
*/
private void writeObject(ObjectOutputStream s) throws IOException {
FileSystemView fsv = null;
--- 1958,1969 ----
installShowFilesListener();
}
/**
! * See {@code readObject} and {@code writeObject} in
! * {@code JComponent} for more
* information about serialization in Swing.
*/
private void writeObject(ObjectOutputStream s) throws IOException {
FileSystemView fsv = null;
*** 1994,2011 ****
}
}
/**
! * Returns a string representation of this <code>JFileChooser</code>.
* This method
* is intended to be used only for debugging purposes, and the
* content and format of the returned string may vary between
* implementations. The returned string may be empty but may not
! * be <code>null</code>.
*
! * @return a string representation of this <code>JFileChooser</code>
*/
protected String paramString() {
String approveButtonTextString = (approveButtonText != null ?
approveButtonText: "");
String dialogTitleString = (dialogTitle != null ?
--- 1994,2011 ----
}
}
/**
! * Returns a string representation of this {@code JFileChooser}.
* This method
* is intended to be used only for debugging purposes, and the
* content and format of the returned string may vary between
* implementations. The returned string may be empty but may not
! * be {@code null}.
*
! * @return a string representation of this {@code JFileChooser}
*/
protected String paramString() {
String approveButtonTextString = (approveButtonText != null ?
approveButtonText: "");
String dialogTitleString = (dialogTitle != null ?
*** 2077,2087 ****
return accessibleContext;
}
/**
* This class implements accessibility support for the
! * <code>JFileChooser</code> class. It provides an implementation of the
* Java Accessibility API appropriate to file chooser user-interface
* elements.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class AccessibleJFileChooser extends AccessibleJComponent {
--- 2077,2087 ----
return accessibleContext;
}
/**
* This class implements accessibility support for the
! * {@code JFileChooser} class. It provides an implementation of the
* Java Accessibility API appropriate to file chooser user-interface
* elements.
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class AccessibleJFileChooser extends AccessibleJComponent {
< prev index next >