question: private boolean showFileChooser ( ) { Class dstCategory = Destination . class ; Destination dst = ( Destination ) asCurrent . get ( dstCategory ) ; if ( dst == null ) { dst = ( Destination ) asOriginal . get ( dstCategory ) ; if ( dst == null ) { dst = ( Destination ) psCurrent . getDefaultAttributeValue ( dstCategory ) ; if ( dst == null ) { try { dst = new Destination ( new URI ( "file:out.prn" ) ) ; } catch ( URISyntaxException e ) { } } } } File fileDest ; if ( dst != null ) { try { fileDest = new File ( dst . getURI ( ) ) ; } catch ( Exception e ) { fileDest = new File ( "out.prn" ) ; } } else { fileDest = new File ( "out.prn" ) ; } ValidatingFileChooser jfc = new ValidatingFileChooser ( ) ; jfc . setApproveButtonText ( getMsg ( "button.ok" ) ) ; jfc . setDialogTitle ( getMsg ( "dialog.printtofile" ) ) ; jfc . setDialogType ( JFileChooser . SAVE_DIALOG ) ; jfc . setSelectedFile ( fileDest ) ; int returnVal = jfc . showDialog ( this , null ) ; if ( returnVal == JFileChooser . APPROVE_OPTION ) { fileDest = jfc . getSelectedFile ( ) ; try { asCurrent . add ( new Destination ( fileDest . toURI ( ) ) ) ; } catch ( Exception e ) { asCurrent . remove ( dstCategory ) ; } } else { asCurrent . remove ( dstCategory ) ; } return ( returnVal == JFileChooser . APPROVE_OPTION ) ; }
target:  Displays a JFileChooser that allows the user to select the destination for "Print To File"