JFileChooser Class
Package: javax.swing
The JFileChooser
class lets you display standard Open and Save dialog boxes similar to the ones you’ve seen in other GUI applications. Figure 5-4 shows an Open dialog box created by JChooser
.
Figure 5-4
The result returned by the showOpenDialog
method indicates whether the user chose to open a file or click Cancel, and the JFileChooser
class provides a handy getSelectedFile
method that you can use to get a File
object for the file selected by the user.
Fields
Field |
Description |
|
Returned by the |
|
Returned by the |
|
Returned by the |
|
Used by the |
|
Used by the |
|
Get Java For Dummies Quick Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.