![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e890. Determining If the Approve or Cancel Button Was Clicked in a JFileChooser DialogJFileChooser chooser = new JFileChooser(); // Show the dialog; wait until dialog is closed int result = chooser.showOpenDialog(frame); // Determine which button was clicked to close the dialog switch (result) { case JFileChooser.APPROVE_OPTION: // Approve (Open or Save) was clicked break; case JFileChooser.CANCEL_OPTION: // Cancel or the close-dialog icon was clicked break; case JFileChooser.ERROR_OPTION: // The selection process did not complete successfully break; }
e888. Displaying Only Directories in a File Chooser Dialog e889. Adding a Filter to a File Chooser Dialog e891. Getting and Setting the Current Directory of a JFileChooser Dialog e892. Getting and Setting the Selected File of a JFileChooser Dialog e893. Getting the File-Type Name of a File e894. Copying the Filename Path from a JFileChooser Dialog to the Clipboard
© 2002 Addison-Wesley. |