< prev index next >

src/java.desktop/share/classes/javax/swing/JFileChooser.java

Print this page




 740      * (for example, centered over the component).
 741      * If the parent is <code>null</code>, then the dialog depends on
 742      * no visible window, and it's placed in a
 743      * look-and-feel-dependent position
 744      * such as the center of the screen.
 745      *
 746      * @param   parent  the parent component of the dialog;
 747      *                  can be <code>null</code>
 748      * @param   approveButtonText the text of the <code>ApproveButton</code>
 749      * @return  the return state of the file chooser on popdown:
 750      * <ul>
 751      * <li>JFileChooser.CANCEL_OPTION
 752      * <li>JFileChooser.APPROVE_OPTION
 753      * <li>JFileChooser.ERROR_OPTION if an error occurs or the
 754      *                  dialog is dismissed
 755      * </ul>
 756      * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 757      * returns true.
 758      * @see java.awt.GraphicsEnvironment#isHeadless
 759      */

 760     public int showDialog(Component parent, String approveButtonText)
 761         throws HeadlessException {
 762         if (dialog != null) {
 763             // Prevent to show second instance of dialog if the previous one still exists
 764             return JFileChooser.ERROR_OPTION;
 765         }
 766 
 767         if(approveButtonText != null) {
 768             setApproveButtonText(approveButtonText);
 769             setDialogType(CUSTOM_DIALOG);
 770         }
 771         dialog = createDialog(parent);
 772         dialog.addWindowListener(new WindowAdapter() {
 773             public void windowClosing(WindowEvent e) {
 774                 returnValue = CANCEL_OPTION;
 775             }
 776         });
 777         returnValue = ERROR_OPTION;
 778         rescanCurrentDirectory();
 779 




 740      * (for example, centered over the component).
 741      * If the parent is <code>null</code>, then the dialog depends on
 742      * no visible window, and it's placed in a
 743      * look-and-feel-dependent position
 744      * such as the center of the screen.
 745      *
 746      * @param   parent  the parent component of the dialog;
 747      *                  can be <code>null</code>
 748      * @param   approveButtonText the text of the <code>ApproveButton</code>
 749      * @return  the return state of the file chooser on popdown:
 750      * <ul>
 751      * <li>JFileChooser.CANCEL_OPTION
 752      * <li>JFileChooser.APPROVE_OPTION
 753      * <li>JFileChooser.ERROR_OPTION if an error occurs or the
 754      *                  dialog is dismissed
 755      * </ul>
 756      * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 757      * returns true.
 758      * @see java.awt.GraphicsEnvironment#isHeadless
 759      */
 760     @SuppressWarnings("deprecation")
 761     public int showDialog(Component parent, String approveButtonText)
 762         throws HeadlessException {
 763         if (dialog != null) {
 764             // Prevent to show second instance of dialog if the previous one still exists
 765             return JFileChooser.ERROR_OPTION;
 766         }
 767 
 768         if(approveButtonText != null) {
 769             setApproveButtonText(approveButtonText);
 770             setDialogType(CUSTOM_DIALOG);
 771         }
 772         dialog = createDialog(parent);
 773         dialog.addWindowListener(new WindowAdapter() {
 774             public void windowClosing(WindowEvent e) {
 775                 returnValue = CANCEL_OPTION;
 776             }
 777         });
 778         returnValue = ERROR_OPTION;
 779         rescanCurrentDirectory();
 780 


< prev index next >