/[classpath]/classpath/javax/swing/JFileChooser.java
ViewVC logotype

Diff of /classpath/javax/swing/JFileChooser.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4.2.8 by gnu_andrew, Tue Sep 20 18:46:31 2005 UTC revision 1.4.2.9 by gnu_andrew, Wed Nov 2 00:43:45 2005 UTC
# Line 42  import java.awt.Frame; Line 42  import java.awt.Frame;
42  import java.awt.HeadlessException;  import java.awt.HeadlessException;
43  import java.awt.event.ActionEvent;  import java.awt.event.ActionEvent;
44  import java.awt.event.ActionListener;  import java.awt.event.ActionListener;
45    import java.beans.PropertyChangeEvent;
46  import java.io.File;  import java.io.File;
47  import java.util.ArrayList;  import java.util.ArrayList;
48    
49  import javax.accessibility.Accessible;  import javax.accessibility.Accessible;
50  import javax.accessibility.AccessibleContext;  import javax.accessibility.AccessibleContext;
51    import javax.accessibility.AccessibleRole;
52  import javax.swing.JDialog;  import javax.swing.JDialog;
53  import javax.swing.filechooser.FileFilter;  import javax.swing.filechooser.FileFilter;
54  import javax.swing.filechooser.FileSystemView;  import javax.swing.filechooser.FileSystemView;
# Line 70  public class JFileChooser extends JCompo Line 73  public class JFileChooser extends JCompo
73  {  {
74    private static final long serialVersionUID = 3162921138695327837L;    private static final long serialVersionUID = 3162921138695327837L;
75    
76    /** DOCUMENT ME! */    /**
77       * A dialog type for selecting a file to open.
78       * @see #setDialogType(int)
79       */
80    public static final int OPEN_DIALOG = 0;    public static final int OPEN_DIALOG = 0;
81    
82    /** DOCUMENT ME! */    /**
83       * A dialog type for selecting a file to save.  
84       * @see #setDialogType(int)
85       */
86    public static final int SAVE_DIALOG = 1;    public static final int SAVE_DIALOG = 1;
87    
88    /** DOCUMENT ME! */    /**
89       * A dialog type for some custom purpose.
90       * @see #setDialogType(int)
91       */
92    public static final int CUSTOM_DIALOG = 2;    public static final int CUSTOM_DIALOG = 2;
93    
94    /** DOCUMENT ME! */    /**
95       * A return value indicating the file chooser has been closed by cancelling.
96       *
97       * @see #showOpenDialog(Component)
98       * @see #showSaveDialog(Component)
99       */
100    public static final int CANCEL_OPTION = 1;    public static final int CANCEL_OPTION = 1;
101    
102    /** DOCUMENT ME! */    /**
103       * A return value indicating the file chooser has been closed by approving
104       * the selection.
105       * @see #showOpenDialog(Component)
106       * @see #showSaveDialog(Component)
107       */
108    public static final int APPROVE_OPTION = 0;    public static final int APPROVE_OPTION = 0;
109    
110    /** DOCUMENT ME! */    /**
111       * A return value indicating the file chooser has been closed by some error.
112       * @see #showOpenDialog(Component)
113       * @see #showSaveDialog(Component)
114       */
115    public static final int ERROR_OPTION = -1;    public static final int ERROR_OPTION = -1;
116    
117    /** DOCUMENT ME! */    /**
118       * A selection mode constant indicating acceptance of files only.
119       * @see #setFileSelectionMode(int)
120       */
121    public static final int FILES_ONLY = 0;    public static final int FILES_ONLY = 0;
122    
123    /** DOCUMENT ME! */    /**
124       * A selection mode constant indicating acceptance of directories only.
125       * @see #setFileSelectionMode(int)
126       */
127    public static final int DIRECTORIES_ONLY = 1;    public static final int DIRECTORIES_ONLY = 1;
128    
129    /** DOCUMENT ME! */    /**
130       * A selection mode constant indicating acceptance of files and directories.
131       * @see #setFileSelectionMode(int)
132       */
133    public static final int FILES_AND_DIRECTORIES = 2;    public static final int FILES_AND_DIRECTORIES = 2;
134    
135    /** DOCUMENT ME! */    /**
136       * Action command string for cancelling the current selection.
137       * @see #cancelSelection()
138       */
139    public static final String CANCEL_SELECTION = "CancelSelection";    public static final String CANCEL_SELECTION = "CancelSelection";
140    
141    /** DOCUMENT ME! */    /**
142       * Action command string for approving the current selection.
143       * @see #cancelSelection()
144       */
145    public static final String APPROVE_SELECTION = "ApproveSelection";    public static final String APPROVE_SELECTION = "ApproveSelection";
146    
147    /** DOCUMENT ME! */    /**
148       * The name of the property for the approve button text.
149       * @see #setApproveButtonText(String)
150       */
151    public static final String APPROVE_BUTTON_TEXT_CHANGED_PROPERTY =    public static final String APPROVE_BUTTON_TEXT_CHANGED_PROPERTY =
152      "ApproveButtonTextChangedProperty";      "ApproveButtonTextChangedProperty";
153    
154    /** DOCUMENT ME! */    /**
155       * The name of the property for the approve button tool tip text.
156       * @see #setApproveButtonToolTipText(String)
157       */
158    public static final String APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY =    public static final String APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY =
159      "ApproveButtonToolTipTextChangedProperty";      "ApproveButtonToolTipTextChangedProperty";
160    
161    /** DOCUMENT ME! */    /**
162       * The name of the property for the approve button mnemonic.
163       * @see #setApproveButtonMnemonic(int)
164       */
165    public static final String APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY =    public static final String APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY =
166      "ApproveButtonMnemonicChangedProperty";      "ApproveButtonMnemonicChangedProperty";
167    
168    /** DOCUMENT ME! */    /**
169       * The name of the property for control button visibility.
170       * @see #setControlButtonsAreShown(boolean)
171       */
172    public static final String CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY =    public static final String CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY =
173      "ControlButtonsAreShownChangedProperty";      "ControlButtonsAreShownChangedProperty";
174    
175    /** DOCUMENT ME! */    /**
176       * The name of the property for the current directory.
177       * @see #setCurrentDirectory(File)  
178       */
179    public static final String DIRECTORY_CHANGED_PROPERTY = "directoryChanged";    public static final String DIRECTORY_CHANGED_PROPERTY = "directoryChanged";
180    
181    /** DOCUMENT ME! */    /**
182       * The name of the property for the selected file.
183       * @see #setSelectedFile(File)
184       */
185    public static final String SELECTED_FILE_CHANGED_PROPERTY =    public static final String SELECTED_FILE_CHANGED_PROPERTY =
186      "SelectedFileChangedProperty";      "SelectedFileChangedProperty";
187    
188    /** DOCUMENT ME! */    /**
189       * The name of the property for the selected files.
190       * @see #setSelectedFiles(File[])
191       */
192    public static final String SELECTED_FILES_CHANGED_PROPERTY =    public static final String SELECTED_FILES_CHANGED_PROPERTY =
193      "SelectedFilesChangedProperty";      "SelectedFilesChangedProperty";
194    
195    /** DOCUMENT ME! */    /**
196       * The name of the property for multi-selection.
197       * @see #setMultiSelectionEnabled(boolean)
198       */
199    public static final String MULTI_SELECTION_ENABLED_CHANGED_PROPERTY =    public static final String MULTI_SELECTION_ENABLED_CHANGED_PROPERTY =
200      "MultiSelectionEnabledChangedProperty";      "MultiSelectionEnabledChangedProperty";
201    
202    /** DOCUMENT ME! */    /**
203       * The name of the 'file system view' property.
204       * @see #setFileSystemView(FileSystemView)
205       */
206    public static final String FILE_SYSTEM_VIEW_CHANGED_PROPERTY =    public static final String FILE_SYSTEM_VIEW_CHANGED_PROPERTY =
207      "FileSystemViewChanged";      "FileSystemViewChanged";
208    
209    /** DOCUMENT ME! */    /**
210       * The name of the 'file view' property.
211       * @see #setFileView(FileView)
212       */
213    public static final String FILE_VIEW_CHANGED_PROPERTY = "fileViewChanged";    public static final String FILE_VIEW_CHANGED_PROPERTY = "fileViewChanged";
214    
215    /** DOCUMENT ME! */    /**
216       * The name of the 'file hiding enabled' property.
217       * @see #setFileHidingEnabled(boolean)
218       */
219    public static final String FILE_HIDING_CHANGED_PROPERTY =    public static final String FILE_HIDING_CHANGED_PROPERTY =
220      "FileHidingChanged";      "FileHidingChanged";
221    
222    /** DOCUMENT ME! */    /**
223       * The name of the 'file filter' property.
224       * @see #setFileFilter(FileFilter)
225       */
226    public static final String FILE_FILTER_CHANGED_PROPERTY =    public static final String FILE_FILTER_CHANGED_PROPERTY =
227      "fileFilterChanged";      "fileFilterChanged";
228    
229    /** DOCUMENT ME! */    /**
230       * The name of the 'file selection mode' property.
231       * @see #setFileSelectionMode(int)
232       */
233    public static final String FILE_SELECTION_MODE_CHANGED_PROPERTY =    public static final String FILE_SELECTION_MODE_CHANGED_PROPERTY =
234      "fileSelectionChanged";      "fileSelectionChanged";
235    
236    /** DOCUMENT ME! */    /**
237       * The name of the 'accessory' property.
238       * @see #setAccessory(JComponent)
239       */
240    public static final String ACCESSORY_CHANGED_PROPERTY =    public static final String ACCESSORY_CHANGED_PROPERTY =
241      "AccessoryChangedProperty";      "AccessoryChangedProperty";
242    
243    /** DOCUMENT ME! */    /**
244       * The name of the 'accept all file filter used' property.
245       * @see #setAcceptAllFileFilterUsed(boolean)
246       */
247    public static final String ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY =    public static final String ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY =
248      "acceptAllFileFilterUsedChanged";      "acceptAllFileFilterUsedChanged";
249    
250    /** DOCUMENT ME! */    /**
251       * The name of the 'dialog title' property.
252       * @see #setDialogTitle(String)
253       */
254    public static final String DIALOG_TITLE_CHANGED_PROPERTY =    public static final String DIALOG_TITLE_CHANGED_PROPERTY =
255      "DialogTitleChangedProperty";      "DialogTitleChangedProperty";
256    
257    /** DOCUMENT ME! */    /**
258       * The name of the 'dialog type' property.
259       * @see #setDialogType(int)
260       */
261    public static final String DIALOG_TYPE_CHANGED_PROPERTY =    public static final String DIALOG_TYPE_CHANGED_PROPERTY =
262      "DialogTypeChangedProperty";      "DialogTypeChangedProperty";
263    
264    /** DOCUMENT ME! */    /**
265       * The name of the 'choosable file filters' property.
266       * @see #addChoosableFileFilter(FileFilter)
267       */
268    public static final String CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY =    public static final String CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY =
269      "ChoosableFileFilterChangedProperty";      "ChoosableFileFilterChangedProperty";
270    
271    /** DOCUMENT ME! */    /**
272       * The accessible context.
273       * @see #getAccessibleContext()
274       */
275    protected AccessibleContext accessibleContext;    protected AccessibleContext accessibleContext;
276    
277    /** DOCUMENT ME! */    /**
278       * The file system view.
279       * @see #setFileSystemView(FileSystemView)
280       */
281    private FileSystemView fsv;    private FileSystemView fsv;
282    
283    /** DOCUMENT ME! */    /**
284       * The accessory component.
285       * @see #setAccessory(JComponent)
286       */
287    private JComponent accessory;    private JComponent accessory;
288    
289    /** DOCUMENT ME! */    /**
290       * The approve button mnemonic.
291       * @see #setApproveButtonMnemonic(int)
292       */
293    private int approveButtonMnemonic = 0;    private int approveButtonMnemonic = 0;
294    
295    /** DOCUMENT ME! */    /**
296       * The approve button text.
297       * @see #setApproveButtonText(String)
298       */
299    private String approveButtonText;    private String approveButtonText;
300    
301    /** DOCUMENT ME! */    /**
302       * The approve button tool tip text.
303       * @see #setApproveButtonToolTipText(String)
304       */
305    private String approveButtonToolTipText;    private String approveButtonToolTipText;
306    
307    /** DOCUMENT ME! */    /**
308       * The choosable file filters.
309       * @see #addChoosableFileFilter(FileFilter)
310       */
311    private ArrayList choosableFilters = new ArrayList();    private ArrayList choosableFilters = new ArrayList();
312    
313    /** DOCUMENT ME! */    /**
314       * A flag controlling whether the accept all file filter is used.
315       * @see #setAcceptAllFileFilterUsed(boolean)
316       */
317    private boolean isAcceptAll = true;    private boolean isAcceptAll = true;
318    
319    /** DOCUMENT ME! */    /**
320       * The dialog title.
321       * @see #setDialogTitle(String)
322       */
323    private String dialogTitle;    private String dialogTitle;
324    
325    /** DOCUMENT ME! */    /**
326       * The dialog type.
327       * @see #setDialogType(int)
328       */
329    private int dialogType = OPEN_DIALOG;    private int dialogType = OPEN_DIALOG;
330    
331    /** DOCUMENT ME! */    /**
332       * The return value for the dialog.
333       * @see #showOpenDialog(Component)
334       * @see #showSaveDialog(Component)
335       */
336    private int retval = ERROR_OPTION;    private int retval = ERROR_OPTION;
337    
338    /** DOCUMENT ME! */    /**
339       * A flag indicating whether the file chooser allows multiple selection.
340       * @see #isMultiSelectionEnabled()
341       */
342    private boolean multiSelection = false;    private boolean multiSelection = false;
343    
344    /** DOCUMENT ME! */    /**
345       * A flag indicating whether file hiding is enabled.
346       * @see #isFileHidingEnabled()
347       */
348    private boolean fileHiding = true;    private boolean fileHiding = true;
349    
350    /** DOCUMENT ME! */    /**
351       * The file selection mode.
352       * @see #setFileSelectionMode(int)
353       */
354    private int fileSelectionMode = FILES_AND_DIRECTORIES;    private int fileSelectionMode = FILES_AND_DIRECTORIES;
355    
356    /** DOCUMENT ME! */    /**
357       * The file view.
358       * @see #setFileView(FileView)
359       */
360    private FileView fv = null;    private FileView fv = null;
361    
362    /** DOCUMENT ME! */    /**
363       * A flag controlling whether or not the control buttons are visible.
364       * @see #setControlButtonsAreShown(boolean)
365       */
366    private boolean controlButtonsShown = true;    private boolean controlButtonsShown = true;
367    
368    /** DOCUMENT ME! */    /**
369       * The current directory.
370       * @see #setCurrentDirectory(File)
371       */
372    private File currentDir = null;    private File currentDir = null;
373    
374    /** DOCUMENT ME! */    /**
375       * The current file filter.
376       * @see #setFileFilter(FileFilter)
377       */
378    private FileFilter currentFilter = null;    private FileFilter currentFilter = null;
379    
380    /** DOCUMENT ME! */    /**
381       * An array of selected files.
382       * @see #setSelectedFiles(File[])
383       */
384    private File[] selectedFiles;    private File[] selectedFiles;
385    
386    /** DOCUMENT ME! */    /**
387       * The selected file.
388       * @see #setSelectedFile(File)
389       */
390    private File selectedFile;    private File selectedFile;
391    
392    /**    /**
393     * Creates a new JFileChooser object.     * Creates a new <code>JFileChooser</code> object.
394     */     */
395    public JFileChooser()    public JFileChooser()
396    {    {
# Line 243  public class JFileChooser extends JCompo Line 399  public class JFileChooser extends JCompo
399    }    }
400    
401    /**    /**
402     * Creates a new JFileChooser object.     * Creates a new <code>JFileChooser</code> object.
403     *     *
404     * @param currentDirectoryPath DOCUMENT ME!     * @param currentDirectoryPath the directory that should initially be
405       *        shown in the filechooser (if <code>null</code>, the user's home
406       *        directory is used).
407     */     */
408    public JFileChooser(String currentDirectoryPath)    public JFileChooser(String currentDirectoryPath)
409    {    {
# Line 254  public class JFileChooser extends JCompo Line 412  public class JFileChooser extends JCompo
412    }    }
413    
414    /**    /**
415     * Creates a new JFileChooser object with the specified directory and     * Creates a new <code>JFileChooser</code> object with the specified
416     * FileSystemView.     * directory and {@link FileSystemView}.
417     *     *
418     * @param currentDirectoryPath the directory that should initially be     * @param currentDirectoryPath  the directory that should initially be
419     *     shown the filechooser     *        shown in the filechooser (if <code>null</code>, the user's home
420     * @param fsv the FileSystemView object to use     *        directory is used).
421       * @param fsv  the file system view (if <code>null</code>, the default file
422       *             system view is used).
423     */     */
424    public JFileChooser(String currentDirectoryPath, FileSystemView fsv)    public JFileChooser(String currentDirectoryPath, FileSystemView fsv)
425    {    {
# Line 268  public class JFileChooser extends JCompo Line 428  public class JFileChooser extends JCompo
428    }    }
429    
430    /**    /**
431     * Creates a new JFileChooser object.     * Creates a new <code>JFileChooser</code> object.
432     *     *
433     * @param currentDirectory DOCUMENT ME!     * @param currentDirectory  the directory that should initially be
434       *        shown in the filechooser (if <code>null</code>, the user's home
435       *        directory is used).
436     */     */
437    public JFileChooser(File currentDirectory)    public JFileChooser(File currentDirectory)
438    {    {
# Line 279  public class JFileChooser extends JCompo Line 441  public class JFileChooser extends JCompo
441    }    }
442    
443    /**    /**
444     * Creates a new JFileChooser object.     * Creates a new <code>JFileChooser</code> object.
445     *     *
446     * @param fsv DOCUMENT ME!     * @param fsv  the file system view (if <code>null</code>, the default file
447       *             system view is used).
448     */     */
449    public JFileChooser(FileSystemView fsv)    public JFileChooser(FileSystemView fsv)
450    {    {
# Line 290  public class JFileChooser extends JCompo Line 453  public class JFileChooser extends JCompo
453    }    }
454    
455    /**    /**
456     * Creates a new JFileChooser object.     * Creates a new <code>JFileChooser</code> object.
457     *     *
458     * @param currentDirectory DOCUMENT ME!     * @param currentDirectory  the directory that should initially be
459     * @param fsv DOCUMENT ME!     *        shown in the filechooser (if <code>null</code>, the user's home
460       *        directory is used).
461       * @param fsv  the file system view (if <code>null</code>, the default file
462       *             system view is used).
463     */     */
464    public JFileChooser(File currentDirectory, FileSystemView fsv)    public JFileChooser(File currentDirectory, FileSystemView fsv)
465    {    {
# Line 302  public class JFileChooser extends JCompo Line 468  public class JFileChooser extends JCompo
468    }    }
469    
470    /**    /**
471     * DOCUMENT ME!     * Sets up the file chooser.  This method is called by all the constructors.
472     *     *
473     * @param view DOCUMENT ME!     * @param view  the file system view (if <code>null</code>, the default file
474       *              system view is used).
475       *
476       * @see FileSystemView#getFileSystemView()
477     */     */
478    protected void setup(FileSystemView view)    protected void setup(FileSystemView view)
479    {    {
# Line 336  public class JFileChooser extends JCompo Line 505  public class JFileChooser extends JCompo
505    }    }
506    
507    /**    /**
508     * DOCUMENT ME!     * Returns the selected file, if there is one.
509     *     *
510     * @return DOCUMENT ME!     * @return The selected file (possibly <code>null</code>).
511       *
512       * @see #setSelectedFile(File)
513     */     */
514    public File getSelectedFile()    public File getSelectedFile()
515    {    {
# Line 346  public class JFileChooser extends JCompo Line 517  public class JFileChooser extends JCompo
517    }    }
518    
519    /**    /**
520     * DOCUMENT ME!     * Sets the selected file and sends a {@link PropertyChangeEvent} to all
521       * registered listeners.  The property name is
522       * {@link #SELECTED_FILE_CHANGED_PROPERTY}.
523     *     *
524     * @param file DOCUMENT ME!     * @param file  the file (<code>null</code> permitted).
525     */     */
526    public void setSelectedFile(File file)    public void setSelectedFile(File file)
527    {    {
# Line 361  public class JFileChooser extends JCompo Line 534  public class JFileChooser extends JCompo
534    }    }
535    
536    /**    /**
537     * DOCUMENT ME!     * Returns the selected file or files.
538     *     *
539     * @return DOCUMENT ME!     * @return An array of the selected files, or <code>null</code> if there are
540       *         no selected files.
541     */     */
542    public File[] getSelectedFiles()    public File[] getSelectedFiles()
543    {    {
# Line 375  public class JFileChooser extends JCompo Line 549  public class JFileChooser extends JCompo
549    }    }
550    
551    /**    /**
552     * DOCUMENT ME!     * Sets the selected files and sends a {@link PropertyChangeEvent} (with the
553       * name {@link #SELECTED_FILES_CHANGED_PROPERTY}) to all registered
554       * listeners.  
555     *     *
556     * @param selectedFiles DOCUMENT ME!     * @param selectedFiles  the selected files (<code>null</code> permitted).
557     */     */
558    public void setSelectedFiles(File[] selectedFiles)    public void setSelectedFiles(File[] selectedFiles)
559    {    {
# Line 393  public class JFileChooser extends JCompo Line 569  public class JFileChooser extends JCompo
569    }    }
570    
571    /**    /**
572     * DOCUMENT ME!     * Returns the current directory.
573     *     *
574     * @return DOCUMENT ME!     * @return The current directory.
575     */     */
576    public File getCurrentDirectory()    public File getCurrentDirectory()
577    {    {
# Line 403  public class JFileChooser extends JCompo Line 579  public class JFileChooser extends JCompo
579    }    }
580    
581    /**    /**
582     * DOCUMENT ME!     * Sets the current directory and fires a {@link PropertyChangeEvent} (with
583     *     * the property name {@link #DIRECTORY_CHANGED_PROPERTY}) to all registered
584     * @param dir DOCUMENT ME!     * listeners.  If <code>dir</code> is <code>null</code>, the current
585       * directory is set to the default directory returned by the file system
586       * view.
587       *
588       * @param dir  the new directory (<code>null</code> permitted).
589       *
590       * @see FileSystemView#getDefaultDirectory()
591     */     */
592    public void setCurrentDirectory(File dir)    public void setCurrentDirectory(File dir)
593    {    {
# Line 421  public class JFileChooser extends JCompo Line 603  public class JFileChooser extends JCompo
603    }    }
604    
605    /**    /**
606     * DOCUMENT ME!     * Called by the UI delegate when the parent directory is changed.
607     */     */
608    public void changeToParentDirectory()    public void changeToParentDirectory()
609    {    {
# Line 430  public class JFileChooser extends JCompo Line 612  public class JFileChooser extends JCompo
612    }    }
613    
614    /**    /**
615     * DOCUMENT ME!     * Rescans the current directory (this is handled by the UI delegate).
616     */     */
617    public void rescanCurrentDirectory()    public void rescanCurrentDirectory()
618    {    {
# Line 438  public class JFileChooser extends JCompo Line 620  public class JFileChooser extends JCompo
620    }    }
621    
622    /**    /**
623     * DOCUMENT ME!     * Ensures the the specified file is visible (this is handled by the
624       * UI delegate).
625     *     *
626     * @param f DOCUMENT ME!     * @param f  the file.
627     */     */
628    public void ensureFileIsVisible(File f)    public void ensureFileIsVisible(File f)
629    {    {
# Line 448  public class JFileChooser extends JCompo Line 631  public class JFileChooser extends JCompo
631    }    }
632    
633    /**    /**
634     * DOCUMENT ME!     * Displays the file chooser in a modal dialog using the
635       * {@link #OPEN_DIALOG} type.
636     *     *
637     * @param parent DOCUMENT ME!     * @param parent  the parent component.
638     *     *
639     * @return DOCUMENT ME!     * @return A return value indicating how the dialog was closed (one of
640       *         {@link #APPROVE_OPTION}, {@link #CANCEL_OPTION} and
641       *         {@link #ERROR_OPTION}).
642     *     *
643     * @throws HeadlessException DOCUMENT ME!     * @throws HeadlessException DOCUMENT ME!
644     */     */
# Line 472  public class JFileChooser extends JCompo Line 658  public class JFileChooser extends JCompo
658    }    }
659    
660    /**    /**
661     * DOCUMENT ME!     * Displays the file chooser in a modal dialog using the
662       * {@link #SAVE_DIALOG} type.
663     *     *
664     * @param parent DOCUMENT ME!     * @param parent  the parent component.
665     *     *
666     * @return DOCUMENT ME!     * @return A return value indicating how the dialog was closed (one of
667       *         {@link #APPROVE_OPTION}, {@link #CANCEL_OPTION} and
668       *         {@link #ERROR_OPTION}).
669     *     *
670     * @throws HeadlessException DOCUMENT ME!     * @throws HeadlessException DOCUMENT ME!
671     */     */
# Line 493  public class JFileChooser extends JCompo Line 682  public class JFileChooser extends JCompo
682    }    }
683    
684    /**    /**
685     * DOCUMENT ME!     * Displays the file chooser in a modal dialog using the
686       * {@link #CUSTOM_DIALOG} type.
687     *     *
688     * @param parent DOCUMENT ME!     * @param parent  the parent component.
    * @param approveButtonText DOCUMENT ME!  
689     *     *
690     * @return DOCUMENT ME!     * @return A return value indicating how the dialog was closed (one of
691       *         {@link #APPROVE_OPTION}, {@link #CANCEL_OPTION} and
692       *         {@link #ERROR_OPTION}).
693     *     *
694     * @throws HeadlessException DOCUMENT ME!     * @throws HeadlessException DOCUMENT ME!
695     */     */
# Line 517  public class JFileChooser extends JCompo Line 708  public class JFileChooser extends JCompo
708    }    }
709    
710    /**    /**
711     * DOCUMENT ME!     * Creates a modal dialog in which to display the file chooser.
712     *     *
713     * @param parent DOCUMENT ME!     * @param parent  the parent component.
714     *     *
715     * @return DOCUMENT ME!     * @return The dialog.
716     *     *
717     * @throws HeadlessException DOCUMENT ME!     * @throws HeadlessException DOCUMENT ME!
718     */     */
# Line 542  public class JFileChooser extends JCompo Line 733  public class JFileChooser extends JCompo
733    }    }
734    
735    /**    /**
736     * DOCUMENT ME!     * Returns the flag that controls whether or not the control buttons are
737       * shown on the file chooser.
738     *     *
739     * @return DOCUMENT ME!     * @return A boolean.
740       *
741       * @see #setControlButtonsAreShown(boolean)
742     */     */
743    public boolean getControlButtonsAreShown()    public boolean getControlButtonsAreShown()
744    {    {
# Line 552  public class JFileChooser extends JCompo Line 746  public class JFileChooser extends JCompo
746    }    }
747    
748    /**    /**
749     * DOCUMENT ME!     * Sets the flag that controls whether or not the control buttons are
750       * shown and, if it changes, sends a {@link PropertyChangeEvent} (with the
751       * property name {@link #CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY}) to
752       * all registered listeners.
753     *     *
754     * @param b DOCUMENT ME!     * @param b  the new value for the flag.
755     */     */
756    public void setControlButtonsAreShown(boolean b)    public void setControlButtonsAreShown(boolean b)
757    {    {
# Line 567  public class JFileChooser extends JCompo Line 764  public class JFileChooser extends JCompo
764    }    }
765    
766    /**    /**
767     * DOCUMENT ME!     * Returns the type of file chooser.
768     *     *
769     * @return DOCUMENT ME!     * @return {@link #OPEN_DIALOG}, {@link #SAVE_DIALOG} or
770       * {@link #CUSTOM_DIALOG}.
771       *
772       * @see #setDialogType(int)
773     */     */
774    public int getDialogType()    public int getDialogType()
775    {    {
# Line 577  public class JFileChooser extends JCompo Line 777  public class JFileChooser extends JCompo
777    }    }
778    
779    /**    /**
780     * DOCUMENT ME!     * Sets the dialog type and fires a {@link PropertyChangeEvent} (with the
781     *     * property name {@link #DIALOG_TYPE_CHANGED_PROPERTY}) to all
782     * @param dialogType DOCUMENT ME!     * registered listeners.
783       *
784       * @param dialogType  the dialog type (one of: {@link #OPEN_DIALOG},
785       * {@link #SAVE_DIALOG}, {@link #CUSTOM_DIALOG}).
786       *
787       * @throws IllegalArgumentException if <code>dialogType</code> is not valid.
788     */     */
789    public void setDialogType(int dialogType)    public void setDialogType(int dialogType)
790    {    {
# Line 596  public class JFileChooser extends JCompo Line 801  public class JFileChooser extends JCompo
801    }    }
802    
803    /**    /**
804     * DOCUMENT ME!     * Sets the dialog title and sends a {@link PropertyChangeEvent} (with the
805     *     * property name {@link #DIALOG_TITLE_CHANGED_PROPERTY}) to all
806     * @param dialogTitle DOCUMENT ME!     * registered listeners.
807       *
808       * @param dialogTitle  the dialog title (<code>null</code> permitted).
809       *
810       * @see #getDialogTitle()
811     */     */
812    public void setDialogTitle(String dialogTitle)    public void setDialogTitle(String dialogTitle)
813    {    {
# Line 611  public class JFileChooser extends JCompo Line 820  public class JFileChooser extends JCompo
820    }    }
821    
822    /**    /**
823     * DOCUMENT ME!     * Returns the dialog title.
824     *     *
825     * @return DOCUMENT ME!     * @return The dialog title (possibly <code>null</code>).
826       *
827       * @see #setDialogTitle(String)
828     */     */
829    public String getDialogTitle()    public String getDialogTitle()
830    {    {
# Line 621  public class JFileChooser extends JCompo Line 832  public class JFileChooser extends JCompo
832    }    }
833    
834    /**    /**
835     * DOCUMENT ME!     * Sets the tool tip text for the approve button and sends a
836       * {@link PropertyChangeEvent} (with the property name
837       * {@link #APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY}) to all
838       * registered listeners.
839     *     *
840     * @param toolTipText DOCUMENT ME!     * @param toolTipText  the text.
841     */     */
842    public void setApproveButtonToolTipText(String toolTipText)    public void setApproveButtonToolTipText(String toolTipText)
843    {    {
# Line 637  public class JFileChooser extends JCompo Line 851  public class JFileChooser extends JCompo
851    }    }
852    
853    /**    /**
854     * DOCUMENT ME!     * Returns the tool tip text for the approve button.
855     *     *
856     * @return DOCUMENT ME!     * @return The tool tip text for the approve button.
857       *
858       * @see #setApproveButtonToolTipText(String)
859     */     */
860    public String getApproveButtonToolTipText()    public String getApproveButtonToolTipText()
861    {    {
# Line 647  public class JFileChooser extends JCompo Line 863  public class JFileChooser extends JCompo
863    }    }
864    
865    /**    /**
866     * DOCUMENT ME!     * Returns the approve button mnemonic, or zero if no mnemonic has been set.
867     *     *
868     * @return DOCUMENT ME!     * @return The approve button mnemonic.
869       *
870       * @see #setApproveButtonMnemonic(int)
871     */     */
872    public int getApproveButtonMnemonic()    public int getApproveButtonMnemonic()
873    {    {
# Line 657  public class JFileChooser extends JCompo Line 875  public class JFileChooser extends JCompo
875    }    }
876    
877    /**    /**
878     * DOCUMENT ME!     * Sets the mnemonic for the approve button and sends a
879     *     * {@link PropertyChangeEvent} (with the property name
880     * @param mnemonic DOCUMENT ME!     * {@link #APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY}) to all registered
881       * listeners.
882       *
883       * @param mnemonic  the mnemonic.
884       *
885       * @see #setApproveButtonMnemonic(char)
886     */     */
887    public void setApproveButtonMnemonic(int mnemonic)    public void setApproveButtonMnemonic(int mnemonic)
888    {    {
# Line 673  public class JFileChooser extends JCompo Line 896  public class JFileChooser extends JCompo
896    }    }
897    
898    /**    /**
899     * DOCUMENT ME!     * Sets the mnemonic for the approve button and sends a
900     *     * {@link PropertyChangeEvent} (with the property name
901     * @param mnemonic DOCUMENT ME!     * {@link #APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY}) to all registered
902       * listeners.
903       *
904       * @param mnemonic  the mnemonic.
905       *
906       * @see #setApproveButtonMnemonic(int)
907     */     */
908    public void setApproveButtonMnemonic(char mnemonic)    public void setApproveButtonMnemonic(char mnemonic)
909    {    {
# Line 683  public class JFileChooser extends JCompo Line 911  public class JFileChooser extends JCompo
911    }    }
912    
913    /**    /**
914     * DOCUMENT ME!     * Sets the approve button text and fires a {@link PropertyChangeEvent}
915     *     * (with the property name {@link #APPROVE_BUTTON_TEXT_CHANGED_PROPERTY}) to
916     * @param approveButtonText DOCUMENT ME!     * all registered listeners.
917       *
918       * @param approveButtonText  the text (<code>null</code> permitted).
919       *
920       * @see #getApproveButtonText()
921     */     */
922    public void setApproveButtonText(String approveButtonText)    public void setApproveButtonText(String approveButtonText)
923    {    {
# Line 699  public class JFileChooser extends JCompo Line 931  public class JFileChooser extends JCompo
931    }    }
932    
933    /**    /**
934     * DOCUMENT ME!     * Returns the approve button text.
935     *     *
936     * @return DOCUMENT ME!     * @return The approve button text (possibly <code>null</code>).
937       *
938       * @see #setApproveButtonText(String)
939     */     */
940    public String getApproveButtonText()    public String getApproveButtonText()
941    {    {
# Line 709  public class JFileChooser extends JCompo Line 943  public class JFileChooser extends JCompo
943    }    }
944    
945    /**    /**
946     * DOCUMENT ME!     * Returns the available file filters for this file chooser.
947     *     *
948     * @return DOCUMENT ME!     * @return The available file filters.
949     */     */
950    public FileFilter[] getChoosableFileFilters()    public FileFilter[] getChoosableFileFilters()
951    {    {
# Line 719  public class JFileChooser extends JCompo Line 953  public class JFileChooser extends JCompo
953    }    }
954    
955    /**    /**
956     * DOCUMENT ME!     * Adds a file filter to the list of available filters and sends a
957       * {@link PropertyChangeEvent} (with the property name
958       * {@link #CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY}) to all registered
959       * listeners.
960     *     *
961     * @param filter DOCUMENT ME!     * @param filter  the filter.
962     */     */
963    public void addChoosableFileFilter(FileFilter filter)    public void addChoosableFileFilter(FileFilter filter)
964    {    {
# Line 732  public class JFileChooser extends JCompo Line 969  public class JFileChooser extends JCompo
969    }    }
970    
971    /**    /**
972     * DOCUMENT ME!     * Removes a file filter from the list of available filters and sends a
973       * {@link PropertyChangeEvent} (with the property name
974       * {@link #CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY}) to all registered
975       * listeners.
976     *     *
977     * @param f DOCUMENT ME!     * @param f  the file filter.
978     *     *
979     * @return DOCUMENT ME!     * @return <code>true</code> if the filter was removed and
980       *         <code>false</code> otherwise.
981     */     */
982    public boolean removeChoosableFileFilter(FileFilter f)    public boolean removeChoosableFileFilter(FileFilter f)
983    {    {
# Line 749  public class JFileChooser extends JCompo Line 990  public class JFileChooser extends JCompo
990    }    }
991    
992    /**    /**
993     * DOCUMENT ME!     * Clears the list of choosable file filters and installs the 'accept all'
994       * filter from the UI delegate.
995     */     */
996    public void resetChoosableFileFilters()    public void resetChoosableFileFilters()
997    {    {
# Line 759  public class JFileChooser extends JCompo Line 1001  public class JFileChooser extends JCompo
1001    }    }
1002    
1003    /**    /**
1004     * DOCUMENT ME!     * Returns the 'accept all' file filter from the UI delegate.
1005     *     *
1006     * @return DOCUMENT ME!     * @return The 'accept all' file filter.
1007     */     */
1008    public FileFilter getAcceptAllFileFilter()    public FileFilter getAcceptAllFileFilter()
1009    {    {
# Line 769  public class JFileChooser extends JCompo Line 1011  public class JFileChooser extends JCompo
1011    }    }
1012    
1013    /**    /**
1014     * DOCUMENT ME!     * Returns the flag that controls whether or not the 'accept all' file
1015       * filter is included in the list of filters.
1016     *     *
1017     * @return DOCUMENT ME!     * @return A boolean.
1018       *
1019       * @see #setAcceptAllFileFilterUsed(boolean)
1020     */     */
1021    public boolean isAcceptAllFileFilterUsed()    public boolean isAcceptAllFileFilterUsed()
1022    {    {
# Line 779  public class JFileChooser extends JCompo Line 1024  public class JFileChooser extends JCompo
1024    }    }
1025    
1026    /**    /**
1027     * DOCUMENT ME!     * Sets the flag that controls whether or not the 'accept all' file filter
1028       * is included in the list of filters, and sends a
1029       * {@link PropertyChangeEvent} (with the property name
1030       * {@link #ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY}) to all registered
1031       * listeners.
1032     *     *
1033     * @param b DOCUMENT ME!     * @param b  the new value of the flag.
1034     */     */
1035    public void setAcceptAllFileFilterUsed(boolean b)    public void setAcceptAllFileFilterUsed(boolean b)
1036    {    {
# Line 794  public class JFileChooser extends JCompo Line 1043  public class JFileChooser extends JCompo
1043    }    }
1044    
1045    /**    /**
1046     * DOCUMENT ME!     * Returns the accessory component for the file chooser.  The default
1047       * value is <code>null</code>.
1048     *     *
1049     * @return DOCUMENT ME!     * @return The accessory component (possibly <code>null</code>).
1050       *
1051       * @see #setAccessory(JComponent)
1052     */     */
1053    public JComponent getAccessory()    public JComponent getAccessory()
1054    {    {
# Line 804  public class JFileChooser extends JCompo Line 1056  public class JFileChooser extends JCompo
1056    }    }
1057    
1058    /**    /**
1059     * DOCUMENT ME!     * Sets the accessory component for the file chooser and sends a
1060       * {@link PropertyChangeEvent} to all registered listeners.  The property
1061       * name is {@link #ACCESSORY_CHANGED_PROPERTY}.
1062     *     *
1063     * @param newAccessory DOCUMENT ME!     * @param newAccessory  the accessory component.
1064     */     */
1065    public void setAccessory(JComponent newAccessory)    public void setAccessory(JComponent newAccessory)
1066    {    {
# Line 819  public class JFileChooser extends JCompo Line 1073  public class JFileChooser extends JCompo
1073    }    }
1074    
1075    /**    /**
1076     * DOCUMENT ME!     * Sets the file selection mode and sends a {@link PropertyChangeEvent}
1077     *     * to all registered listeners.  The property name is
1078     * @param mode DOCUMENT ME!     * {@link #FILE_SELECTION_MODE_CHANGED_PROPERTY}.
1079       *
1080       * @param mode  the mode ({@link #FILES_ONLY}, {@link #DIRECTORIES_ONLY} or
1081       *              {@link #FILES_AND_DIRECTORIES}).
1082       *
1083       * @throws IllegalArgumentException if the mode is invalid.
1084     */     */
1085    public void setFileSelectionMode(int mode)    public void setFileSelectionMode(int mode)
1086    {    {
# Line 838  public class JFileChooser extends JCompo Line 1097  public class JFileChooser extends JCompo
1097    }    }
1098    
1099    /**    /**
1100     * DOCUMENT ME!     * Returns the file selection mode, one of: {@link #FILES_ONLY},
1101     *     * {@link #DIRECTORIES_ONLY} or {@link #FILES_AND_DIRECTORIES}.  The
1102     * @return DOCUMENT ME!     * default is {@link #FILES_ONLY}.
1103       *
1104       * @return The file selection mode.
1105       *
1106       * @see #setFileSelectionMode(int)
1107     */     */
1108    public int getFileSelectionMode()    public int getFileSelectionMode()
1109    {    {
# Line 848  public class JFileChooser extends JCompo Line 1111  public class JFileChooser extends JCompo
1111    }    }
1112    
1113    /**    /**
1114     * DOCUMENT ME!     * Returns <code>true</code> if file selection is enabled, and
1115     *     * <code>false</code> otherwise.  File selection is enabled when the
1116     * @return DOCUMENT ME!     * file selection mode is {@link #FILES_ONLY} or
1117       * {@link #FILES_AND_DIRECTORIES}.
1118       *
1119       * @return <code>true</code> if file selection is enabled.
1120       *
1121       * @see #getFileSelectionMode()
1122     */     */
1123    public boolean isFileSelectionEnabled()    public boolean isFileSelectionEnabled()
1124    {    {
# Line 859  public class JFileChooser extends JCompo Line 1127  public class JFileChooser extends JCompo
1127    }    }
1128    
1129    /**    /**
1130     * DOCUMENT ME!     * Returns <code>true</code> if directory selection is enabled, and
1131     *     * <code>false</code> otherwise.  Directory selection is enabled when the
1132     * @return DOCUMENT ME!     * file selection mode is {@link #DIRECTORIES_ONLY} or
1133       * {@link #FILES_AND_DIRECTORIES}.
1134       *
1135       * @return <code>true</code> if file selection is enabled.
1136       *
1137       * @see #getFileSelectionMode()
1138     */     */
1139    public boolean isDirectorySelectionEnabled()    public boolean isDirectorySelectionEnabled()
1140    {    {
# Line 870  public class JFileChooser extends JCompo Line 1143  public class JFileChooser extends JCompo
1143    }    }
1144    
1145    /**    /**
1146     * DOCUMENT ME!     * Sets the flag that controls whether multiple selections are allowed in
1147       * this filechooser and sends a {@link PropertyChangeEvent} (with the
1148       * property name {@link #MULTI_SELECTION_ENABLED_CHANGED_PROPERTY}) to all
1149       * registered listeners.
1150     *     *
1151     * @param b DOCUMENT ME!     * @param b  the new value of the flag.
1152     */     */
1153    public void setMultiSelectionEnabled(boolean b)    public void setMultiSelectionEnabled(boolean b)
1154    {    {
# Line 885  public class JFileChooser extends JCompo Line 1161  public class JFileChooser extends JCompo
1161    }    }
1162    
1163    /**    /**
1164     * DOCUMENT ME!     * Returns <code>true</code> if multiple selections are allowed within this
1165       * file chooser, and <code>false</code> otherwise.
1166     *     *
1167     * @return DOCUMENT ME!     * @return A boolean.
1168       *
1169       * @see #setMultiSelectionEnabled(boolean)
1170     */     */
1171    public boolean isMultiSelectionEnabled()    public boolean isMultiSelectionEnabled()
1172    {    {
# Line 895  public class JFileChooser extends JCompo Line 1174  public class JFileChooser extends JCompo
1174    }    }
1175    
1176    /**    /**
1177     * DOCUMENT ME!     * Returns <code>true</code> if hidden files are to be hidden, and
1178       * <code>false</code> otherwise.
1179     *     *
1180     * @return DOCUMENT ME!     * @return A boolean.
1181       *
1182       * @see #setFileHidingEnabled(boolean)
1183     */     */
1184    public boolean isFileHidingEnabled()    public boolean isFileHidingEnabled()
1185    {    {
# Line 905  public class JFileChooser extends JCompo Line 1187  public class JFileChooser extends JCompo
1187    }    }
1188    
1189    /**    /**
1190     * DOCUMENT ME!     * Sets the flag that controls whether or not hidden files are displayed,
1191       * and sends a {@link PropertyChangeEvent} (with the property name
1192       * {@link #FILE_HIDING_CHANGED_PROPERTY}) to all registered listeners.
1193     *     *
1194     * @param b DOCUMENT ME!     * @param b  the new value of the flag.
1195     */     */
1196    public void setFileHidingEnabled(boolean b)    public void setFileHidingEnabled(boolean b)
1197    {    {
# Line 920  public class JFileChooser extends JCompo Line 1204  public class JFileChooser extends JCompo
1204    }    }
1205    
1206    /**    /**
1207     * DOCUMENT ME!     * Sets the file filter and sends a {@link PropertyChangeEvent} (with the
1208       * property name {@link #FILE_FILTER_CHANGED_PROPERTY}) to all registered
1209       * listeners.
1210     *     *
1211     * @param filter DOCUMENT ME!     * @param filter  the filter.
1212     */     */
1213    public void setFileFilter(FileFilter filter)    public void setFileFilter(FileFilter filter)
1214    {    {
# Line 935  public class JFileChooser extends JCompo Line 1221  public class JFileChooser extends JCompo
1221    }    }
1222    
1223    /**    /**
1224     * DOCUMENT ME!     * Returns the file filter.
1225     *     *
1226     * @return DOCUMENT ME!     * @return The file filter.
1227       *
1228       * @see #setFileFilter(FileFilter)
1229     */     */
1230    public FileFilter getFileFilter()    public FileFilter getFileFilter()
1231    {    {
# Line 945  public class JFileChooser extends JCompo Line 1233  public class JFileChooser extends JCompo
1233    }    }
1234    
1235    /**    /**
1236     * DOCUMENT ME!     * Sets a custom {@link FileView} for the file chooser and sends a
1237       * {@link PropertyChangeEvent} to all registered listeners.  The property
1238       * name is {@link #FILE_VIEW_CHANGED_PROPERTY}.
1239       *
1240       * @param fileView  the file view (<code>null</code> permitted).
1241     *     *
1242     * @param fileView DOCUMENT ME!     * @see #getFileView()
1243     */     */
1244    public void setFileView(FileView fileView)    public void setFileView(FileView fileView)
1245    {    {
# Line 960  public class JFileChooser extends JCompo Line 1252  public class JFileChooser extends JCompo
1252    }    }
1253    
1254    /**    /**
1255     * DOCUMENT ME!     * Returns the custom {@link FileView} for the file chooser.
1256     *     *
1257     * @return DOCUMENT ME!     * @return The file view (possibly <code>null</code>).
1258     */     */
1259    public FileView getFileView()    public FileView getFileView()
1260    {    {
# Line 970  public class JFileChooser extends JCompo Line 1262  public class JFileChooser extends JCompo
1262    }    }
1263    
1264    /**    /**
1265     * DOCUMENT ME!     * Returns the name of the file, generated by the current (or default)
1266       * {@link FileView}.
1267     *     *
1268     * @return DOCUMENT ME!     * @param f  the file.
    */  
   private FileView getInternalFileView()  
   {  
     if (fv == null)  
       return getUI().getFileView(this);  
     return fv;  
   }  
   
   /**  
    * DOCUMENT ME!  
1269     *     *
1270     * @param f DOCUMENT ME!     * @return The file name.
    *  
    * @return DOCUMENT ME!  
1271     */     */
1272    public String getName(File f)    public String getName(File f)
1273    {    {
1274      return getInternalFileView().getName(f);      String name = null;
1275        if (fv != null)
1276          name = fv.getName(f);
1277        if (name == null)
1278          name = getUI().getFileView(this).getName(f);
1279        return name;
1280    }    }
1281    
1282    /**    /**
1283     * DOCUMENT ME!     * Returns the description of the file, generated by the current (or default)
1284       * {@link FileView}.
1285     *     *
1286     * @param f DOCUMENT ME!     * @param f  the file.
1287     *     *
1288     * @return DOCUMENT ME!     * @return The file description.
1289     */     */
1290    public String getDescription(File f)    public String getDescription(File f)
1291    {    {
1292      return getInternalFileView().getDescription(f);      String result = null;
1293        if (fv != null)
1294          result = fv.getDescription(f);
1295        if (result == null)
1296          result = getUI().getFileView(this).getDescription(f);
1297        return result;
1298    }    }
1299    
1300    /**    /**
1301     * DOCUMENT ME!     * Returns the type description for the file, generated by the current (or
1302       * default) {@link FileView}.
1303     *     *
1304     * @param f DOCUMENT ME!     * @param f  the file.
1305     *     *
1306     * @return DOCUMENT ME!     * @return The file type description.
1307     */     */
1308    public String getTypeDescription(File f)    public String getTypeDescription(File f)
1309    {    {
1310      return getInternalFileView().getTypeDescription(f);      String result = null;
1311        if (fv != null)
1312          result = getFileView().getTypeDescription(f);
1313        if (result == null)
1314          result = getUI().getFileView(this).getTypeDescription(f);
1315        return result;
1316    }    }
1317    
1318    /**    /**
1319     * DOCUMENT ME!     * Returns the icon provided by the current (or default) {@link FileView}.
1320     *     *
1321     * @param f DOCUMENT ME!     * @param f  the file.
1322     *     *
1323     * @return DOCUMENT ME!     * @return An icon representing the file.
1324     */     */
1325    public Icon getIcon(File f)    public Icon getIcon(File f)
1326    {    {
1327      return getInternalFileView().getIcon(f);      Icon result = null;
1328        if (fv != null)
1329          result = fv.getIcon(f);
1330        if (result == null)
1331          result = getUI().getFileView(this).getIcon(f);
1332        return result;
1333    }    }
1334    
1335    /**    /**
1336     * DOCUMENT ME!     * Returns <code>true</code> if the file is traversable, and
1337       * <code>false</code> otherwise.
1338     *     *
1339     * @param f DOCUMENT ME!     * @param f  the file or directory.
1340     *     *
1341     * @return DOCUMENT ME!     * @return A boolean.
1342     */     */
1343    public boolean isTraversable(File f)    public boolean isTraversable(File f)
1344    {    {
# Line 1042  public class JFileChooser extends JCompo Line 1346  public class JFileChooser extends JCompo
1346    }    }
1347    
1348    /**    /**
1349     * DOCUMENT ME!     * Returns <code>true</code> if the file is accepted by the current
1350       * file filter.
1351     *     *
1352     * @param f DOCUMENT ME!     * @param f  the file.
1353     *     *
1354     * @return DOCUMENT ME!     * @return A boolean.
1355     */     */
1356    public boolean accept(File f)    public boolean accept(File f)
1357    {    {
# Line 1056  public class JFileChooser extends JCompo Line 1361  public class JFileChooser extends JCompo
1361    }    }
1362    
1363    /**    /**
1364     * DOCUMENT ME!     * Sets the file system view for the file chooser and sends a
1365       * {@link PropertyChangeEvent} to all registered listeners.
1366     *     *
1367     * @param fsv DOCUMENT ME!     * @param fsv  the file system view.
1368     */     */
1369    public void setFileSystemView(FileSystemView fsv)    public void setFileSystemView(FileSystemView fsv)
1370    {    {
# Line 1071  public class JFileChooser extends JCompo Line 1377  public class JFileChooser extends JCompo
1377    }    }
1378    
1379    /**    /**
1380     * DOCUMENT ME!     * Returns the file system view being used by this file chooser.
1381     *     *
1382     * @return DOCUMENT ME!     * @return The file system view.
1383       *
1384       * @see #setFileSystemView(FileSystemView)
1385     */     */
1386    public FileSystemView getFileSystemView()    public FileSystemView getFileSystemView()
1387    {    {
# Line 1081  public class JFileChooser extends JCompo Line 1389  public class JFileChooser extends JCompo
1389    }    }
1390    
1391    /**    /**
1392     * DOCUMENT ME!     * Approves the selection.  An {@link ActionEvent} is sent to all registered
1393       * listeners.
1394     */     */
1395    public void approveSelection()    public void approveSelection()
1396    {    {
# Line 1090  public class JFileChooser extends JCompo Line 1399  public class JFileChooser extends JCompo
1399    }    }
1400    
1401    /**    /**
1402     * DOCUMENT ME!     * Cancels the selection. An {@link ActionEvent} is sent to all registered
1403       * listeners.
1404     */     */
1405    public void cancelSelection()    public void cancelSelection()
1406    {    {
# Line 1099  public class JFileChooser extends JCompo Line 1409  public class JFileChooser extends JCompo
1409    }    }
1410    
1411    /**    /**
1412     * DOCUMENT ME!     * Adds an {@link ActionListener} to the file chooser.
1413     *     *
1414     * @param l DOCUMENT ME!     * @param l  the listener.
1415     */     */
1416    public void addActionListener(ActionListener l)    public void addActionListener(ActionListener l)
1417    {    {
# Line 1109  public class JFileChooser extends JCompo Line 1419  public class JFileChooser extends JCompo
1419    }    }
1420    
1421    /**    /**
1422     * DOCUMENT ME!     * Removes an {@link ActionListener} from this file chooser.
1423     *     *
1424     * @param l DOCUMENT ME!     * @param l  the listener.
1425     */     */
1426    public void removeActionListener(ActionListener l)    public void removeActionListener(ActionListener l)
1427    {    {
# Line 1126  public class JFileChooser extends JCompo Line 1436  public class JFileChooser extends JCompo
1436    }    }
1437    
1438    /**    /**
1439     * DOCUMENT ME!     * Returns the action listeners registered with this file chooser.
1440     *     *
1441     * @return DOCUMENT ME!     * @return An array of listeners.
1442     */     */
1443    public ActionListener[] getActionListeners()    public ActionListener[] getActionListeners()
1444    {    {
# Line 1136  public class JFileChooser extends JCompo Line 1446  public class JFileChooser extends JCompo
1446    }    }
1447    
1448    /**    /**
1449     * DOCUMENT ME!     * Sends an @link {ActionEvent} to all registered listeners.
1450     *     *
1451     * @param command DOCUMENT ME!     * @param command  the action command.
1452     */     */
1453    protected void fireActionPerformed(String command)    protected void fireActionPerformed(String command)
1454    {    {
# Line 1151  public class JFileChooser extends JCompo Line 1461  public class JFileChooser extends JCompo
1461    }    }
1462    
1463    /**    /**
1464     * DOCUMENT ME!     * Installs the UI delegate for the current look and feel.
1465     */     */
1466    public void updateUI()    public void updateUI()
1467    {    {
# Line 1160  public class JFileChooser extends JCompo Line 1470  public class JFileChooser extends JCompo
1470    }    }
1471    
1472    /**    /**
1473     * DOCUMENT ME!     * Returns the UI delegate class identifier.
1474     *     *
1475     * @return DOCUMENT ME!     * @return <code>FileChooserUI</code>.
1476     */     */
1477    public String getUIClassID()    public String getUIClassID()
1478    {    {
# Line 1170  public class JFileChooser extends JCompo Line 1480  public class JFileChooser extends JCompo
1480    }    }
1481    
1482    /**    /**
1483     * DOCUMENT ME!     * Returns the UI delegate for the component.
1484     *     *
1485     * @return DOCUMENT ME!     * @return The UI delegate.
1486     */     */
1487    public FileChooserUI getUI()    public FileChooserUI getUI()
1488    {    {
# Line 1190  public class JFileChooser extends JCompo Line 1500  public class JFileChooser extends JCompo
1500    }    }
1501    
1502    /**    /**
1503     * DOCUMENT ME!     * Returns the accessible context.
1504     *     *
1505     * @return DOCUMENT ME!     * @return The accessible context.
1506     */     */
1507    public AccessibleContext getAccessibleContext()    public AccessibleContext getAccessibleContext()
1508    {    {
1509      return null;      return new AccessibleJFileChooser();
1510      }
1511    
1512      /**
1513       * Accessibility support for JFileChooser
1514       */
1515      protected class AccessibleJFileChooser
1516        extends JComponent.AccessibleJComponent
1517      {
1518        protected AccessibleJFileChooser()
1519        {
1520          // Nothing to do here.
1521        }
1522        
1523        public AccessibleRole getAccessibleRole()
1524        {
1525          return AccessibleRole.FILE_CHOOSER;
1526        }
1527    }    }
1528  }  }

Legend:
Removed from v.1.4.2.8  
changed lines
  Added in v.1.4.2.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26