Enhanced JFileChooser for file encoding selection

In many I18N applications, files are stored in different encodings, including Unicode formats. It would be very useful for JFileChooser to have a file encoding selection mechanism similar to that in MS Windows' common file dialogs -- the "Encoding" box can be seen in Windows 2000/XP Notepad's File Open/Save dialog, directly under "File name" and "Save as type" combo boxes.
This enhancement will make JFileChooser closely match Windows standard file dialogs and be a desirable option on other platforms as well.
Vote for Bug Id 4935601:
http://developer.java.sun.com/developer/bugParade/bugs/4935601.html
(also posted in Internationalization Forum)

That is a good point! I think all of documents encoded in Unicode need this feature to be saved correctly.

Similar Messages

  • F4 help for file on selection screen thro objects

    Hi Every one,
    this report is working , but as i am working ECC6.0 it is showing the obsolete statements
    how to rectify it .
    pls anybody let me know,
    tables rlgrap.
    TYPES : BEGIN OF TAB,
    MATNR TYPE MATNR ,
    MTART TYPE MTART,
    END OF TAB.
    DATA : ITAB TYPE  STANDARD TABLE OF TAB ,
           WTAB TYPE TAB.
    data: it_tab type filetable,
          gd_subrc type i.
    data : file0 type string.
    selection-screen begin of block m with frame.
        select-options: so_fpath for rlgrap-filename.
    selection-screen end of block m.
    data wfile like line of so_fpath.
    at selection-screen on value-request for so_fpath-low.
    REFRESH: it_tab.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
        EXPORTING
            WINDOW_TITLE = 'Select File'
            DEFAULT_FILENAME = '*.txt'
            MULTISELECTION = 'X'
        CHANGING
            FILE_TABLE = it_tab
            RC = gd_subrc.
    loop at it_tab into so_fpath-low.
       so_fpath-sign = 'I'.
       so_fpath-option = 'EQ'.
           append  so_fpath.
    endloop.
    move so_fpath+3 to file0.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = FILE0
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'
      TABLES
        DATA_TAB                      = Itab
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    end-of-selection.
    write :/ file0.
    loop at itab into  wtab.
    write :/ wtab-matnr.
    endloop.
    its urgent please...

    See the below ex:change file parameter type .
      DATA: VFILE TYPE STRING.
      DATA: FL(1).
    DATA: L_FILETAB     TYPE FILETABLE,
          L_FILETAB_H   TYPE FILETABLE WITH HEADER LINE,
          INITIAL_DIR_PATH TYPE STRING,
          L_RC          TYPE I.
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    *PARAMETERS: FNAME LIKE RLGRAP-FILENAME OBLIGATORY.
    PARAMETERS: FNAME TYPE LOCALFILE OBLIGATORY.
    SELECTION-SCREEN: END OF BLOCK B1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR FNAME.
    REFRESH L_FILETAB.
      INITIAL_DIR_PATH = 'C:\'.
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
        EXPORTING
        WINDOW_TITLE            = 'Select the Asset Master Data file'
       DEFAULT_EXTENSION       =
       DEFAULT_FILENAME        =
        FILE_FILTER             = 'Text Files (.TXT)|.TXT|'
        INITIAL_DIRECTORY       = INITIAL_DIR_PATH
          MULTISELECTION          = SPACE
       WITH_ENCODING           =
        CHANGING
          FILE_TABLE              = L_FILETAB
          RC                      = L_RC
       USER_ACTION             =
       FILE_ENCODING           =
        EXCEPTIONS
          FILE_OPEN_DIALOG_FAILED = 1
          CNTL_ERROR              = 2
          ERROR_NO_GUI            = 3
          NOT_SUPPORTED_BY_GUI    = 4
          OTHERS                  = 5
      IF SY-SUBRC <> 0.
        WRITE:/ 'Error while selecting the input file'.
      ELSE.
        LOOP AT L_FILETAB INTO L_FILETAB_H.
          FNAME = L_FILETAB_H-FILENAME.
          EXIT.
        ENDLOOP.
      ENDIF.
      FILE = FNAME.
    CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
         FILENAME                      = VFILE
         FILETYPE                      = 'ASC'
         HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
        DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
        TABLES
          DATA_TAB                      = I_TAB
       EXCEPTIONS
         FILE_OPEN_ERROR               = 1
         FILE_READ_ERROR               = 2
         NO_BATCH                      = 3
         GUI_REFUSE_FILETRANSFER       = 4
         INVALID_TYPE                  = 5
         NO_AUTHORITY                  = 6
         UNKNOWN_ERROR                 = 7
         BAD_DATA_FORMAT               = 8
         HEADER_NOT_ALLOWED            = 9
         SEPARATOR_NOT_ALLOWED         = 10
         HEADER_TOO_LONG               = 11
         UNKNOWN_DP_ERROR              = 12
         ACCESS_DENIED                 = 13
         DP_OUT_OF_MEMORY              = 14
         DISK_FULL                     = 15
         DP_TIMEOUT                    = 16
         OTHERS                        = 17
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

  • LSMW :Is it possible to create F4 Help for File path selection

    Hi All .,
    Please let me know is it possible to create F4 help for file path creation in LSMW .
    thanks
    Sreenivas

    Hi,
    I don't get it.
    In the step " Specify files" you will have the option to pick your flat file which is on the desktop by pressing F4 .
    What is that you exactly want??
    Warm regards,
    Hari Kiran

  • How do I add a filter in JFileChooser for files with no extension?

    Is it possible to have a filter with that filters out files with no extension in a JFileChooser?
    Any help is appreciated.
    Shankar

    When you override accept(File), get the filename from the File object, and parse out the extension. I don't remember there being an easy way to get the extension besides looking for a dot and parsing. If there's no extension, accept it.

  • Canon 5D Mk II Raw files not selectable by Adobe DNG 5.5

    Well  to be more clear then the thread header, I am not able to select my old Nikon 5700 Coolpix files either. In other words the files are grey but the Adobe DNG browser is working when looking for file to select. I dropped the first download in the trash and downloaded again but same result.
    I  have CS4 and all software is listed as compatible with Canon 5D mkII files. A friend of my was able open my 5D files from Adobe DNG 5.5 that were on his Windows platform.
    i did not see any special instructions, and seems intuitive enough, but it must be some kind of Adobe 101 question. Any ideas out there. Thanks.

    Well sorry for any confusion here. I don't think my question is vary misleading though.
    I have a MAC using OS 10.4.11. G4 Dual 1000 Gig (2002) processors, 1.5 Gb SDRAM (maxed), Dedicated 80 Gb Scratch Disk for Photoshop, 500 Gb Internal Drive.
    All operations are done using the MAC OS.
    All files are grey when viewed through the  "Adobe DNG Converter 5.5" application browser. If you are familiar when you open Adobe DNG Converter the vary first step in the process is to ( 1. "Select Folder" ). Pressing this button opens a FINDER then if you will , (many applications refer this as using a their browser to locate files for opening).
    I am referring to RAW files, and as stated earlier those from the 5D mk II and those from the  Nikon coolpix 5700 are not available for selection, or opening by Adobe DNG Converter 5.5, yet they are listed as being current with DNG Converter 5.5.   "All files are grey", So none of the image files have black text suggesting you may select those.
    My  understanding is this converter was made for RAW files, not  "jpeg",  in hopes are creating a last RAW file format Standard that would be a usable archival format across mulitple platforms and through time   . The RAW files are Full 21 megapixel files, not the smaller files sizes  of RAW available on the 5D (ie: sRAW1, or sRAW2). The DNG converter should open all 5D mk II RAW files regardless of megapixel size unless otherwise stated.
    My files can not be an issue , because also  stated  was that my files were opened by a DNG converter loaded on a Windows platform.
    Procedure performed as follows:
         - Open DNG Converter 5.5 on my Power MAC
         - Press " Select Folder " step number list as "#1"
         - DNG Finder or Browser opens allowing one to find the folder said RAW files are contained within for purpose of selecting full 21 megapixel RAW Format CR2 files for Conversion processing to a DNG file format.
         - Oops, can't select, files have grey text appearance. There are no image files at all with Black Text of any format available for selection, so can't select.
    Adobe Photoshop CS4, Adobe CS4 Bridge, Adobe Camera RAW, Canon Utility package for the 5D mk II all these applications see the files, and function with them, no crashes, not hang ups, a little slower then the world turns now days but they do what they were meant to do.
    Thanks again.

  • JFileChooser Displays Garbage Icons for Files in 1.4.2-02

    Since switching from 1.3.1 to 1.4.2-02 I no longer get meaningful icons displayed beside file names by JFileChooser. What it is displaying do not look like anything meaningful. I suspect it is just grabbing some random chunk of memory and interpreting it as an icon. In 1.3.1 I got a folder icon for directories and a dog-eared piece of paper for files. I have not changed any of the code here, except to fix a bug where I was passing an invalid object (not a Component) to showOpenDialog, and the problem occurs both before and after that change. I appreciate that I can create a FileView to display whatever icons I want, but I do not understand why the default is garbage.
         JFileChooser chooser;
         String     directory     = parent.getProperty("directory", "");
         if (directory != "")
         chooser = new JFileChooser(directory);
         else
         chooser = new JFileChooser();
         // select only Text and Excel files, but permit multiples to be chosen
         chooser.addChoosableFileFilter(new TxtFileFilter());
         chooser.setFileFilter(new XlsFileFilter());
         chooser.setMultiSelectionEnabled(true);
         // display the dialog and wait for a response
         int option = chooser.showOpenDialog(desk);

    I have since determined that the problem is in FileSystemView.getSystemIcon, which returns a garbage icon on my system.

  • JFileChooser - show files and directories only select directory

    I need a JFileChooser that will display directories and zip files but only allow a directory to be selected.
    basically i need to be able to select a certain directory that contains a certain zip file, so to make it easier to find i want the zip files to show up so i can find the correct directory...
    I tried...
            JFileChooser jfc = new JFileChooser();
            jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            jfc.setFileFilter(new FileFilter() {
                public boolean accept(File f) {
                    if (f.isDirectory()) {
                        return true;
                    else if (f.getName().endsWith(".zip")) {
                        return true;
                    return false;
                public String getDescription() {
                    return "testing";
            });but that only displays directories in the GUI.
    The javadoc for the setFileSelectionMode() says, "Sets the JFileChooser to allow the user to just select files, just select directories, or select both files and directories. The default is JFilesChooser.FILES_ONLY. " ....which makes you think that setting the file selection mode only alters what can be SELECTED...however it alters what is displayed as well.
    ...any ideas?
    thanks

    This should display the files of interest provided the filter is tuned to do so, and allow you to select either the file of interest or the folder... If you select the file, then folder it is contained is returned.
    JFileChooser chooser = new JFileChooser();
    chooser.setCurrentDirectory(new java.io.File("."));
    MyFileFilter filter = new MyFileFilter();
    chooser.setFileFilter(filter);
    chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    int returnVal = chooser.showOpenDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {              
      System.out.println(chooser.getCurrentDirectory());
    }

  • When downloading a file, I select "Save File", but I'm unable to check the box label "Do this automatically for files like this from now on." The box is faded out. It's very tedious when you have to select "Save File" everytime

    Click on the file to download
    The "Open" Dialog Box pops up
    Select "Save File"
    Try to click on the box labeled ""Do this automatically for files like this from now on."
    The box is disable

    Hello melanie90, see : [https://support.mozilla.org/en-US/kb/change-firefox-behavior-when-open-file#w_changing-download-actions Changing download actions]
    thank you

  • F4 help for file path in selection screen.

    Hi there,
    I defined one parameter p_path for file path using RLGRAP-FILENAME. I have not got F4 for this. How to solve this problem, can anybody pls help.
    Regards,
    Naseer.

    Hi,
    refer to the following code:
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_pc.
    DATA: it_tab TYPE filetable,
              wf_subrc TYPE i.
    DATA: wf_pcfile LIKE rlgrap-filename.
      DATA: wf_filter TYPE string,
            wf_dir TYPE string,
            wf_title TYPE string,
            wf_ext TYPE string.
    *  if p_ml = 'X'.                  "Manula Load - PC File
      wf_title = text-012.          "Window title
      wf_ext  = '.TXT'.           "Extension of the file
      wf_filter = 'Text Files (*.TXT)|*.TXT'.         "File Type
      wf_dir = wf_pcfile.           "Directory
    *Adds a GUI-Supported Feature
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title      = wf_title
          default_extension = wf_ext
          file_filter       = wf_filter
          initial_directory = wf_dir
        CHANGING
          file_table        = it_tab
          rc                = wf_subrc.
    Hope this helps.
    <REMOVED BY MODERATOR>
    Regards,
    Sipra
    Edited by: Alvaro Tejada Galindo on Jan 31, 2008 9:48 AM

  • WHY does the finder insist on rearranging the files in a folder in alphabetical order even when I have selected "none" in the preferences for file organization?

    WHY does the finder insist on rearranging the files and/or documents in a folder in alphabetical order even when I have selected "none" in the preferences for file organization? Even after I numbered the documents/folders to keep them in my preferred order, it will still displace them occasionally. This is becoming increasingly frustrating!
    Is this a "Pages" issue or "FInder"? The vast majority of documents I use are in Pages, but there are also Numbers, PDFs, jpegs and a few other applications involved. This never happened before I upgraded to Mountain Lion; in Tiger, the documents (mostly Appleworks) and files stayed where I wanted them to be.
    I am visually oriented, and prefer to arrange items in a folder in an order that makes them easier for me to access, which is often NOT alphabetical.
    Can anyone suggest a solution? Please??
    Thank you.
    Sara

    nbar,
    Thank you for your reply.
    However, I do not understand what you mean by "user account." I am the only user, and can find no options for "user" or "guest." The parental controls have always been off, as there are no other people who have access to my computer.
    Frank,
    Thank you for your reply.
    All my documents, files and folders are in icon view, Arranged By: none in both view and view options. This arbitrary rearranging does not happen all the time, only when I make a substantial change to one of the documents in the file or folder. I'm not sure what you mean by "column heading."
    MichaelLAX,
    Thank you for your reply.
    I know, to my sorrow, that Appleworks does not work with Mountain Lion. I spent at least three months converting approximately 2,000 Appleworks documents to Pages, Numbers, Bento (for databases) and Touchdraw (for drawings). So this is not the problem; but as I said, I did not have this rearranging problem with Appleworks - the icons stayed where I wanted them to be. I still miss the ease and reliability of Appleworks, darn it!
    Frank,
    Thank you for your second reply.
    I do have the Sort By: in view options as well as in view set to "none."   The finder still insists on rearranging, but only when I have made a substantial change to a document in that file or folder.
    Any futher thoughts?
    xdab, 
    Thank you for your reply.
    "Are you are using icon view, but for some reason the finder moves files around? is that the problem?"
    YES!! This is exactly the problem.
    "If this operation is successful then erase the original and rename the new one to the name originally chosen by the user."
    This seems like a lot of trouble, especially as I often work on several documents at the same time.
    "By the way, the finder has a "clean up by" menu that rearranges icons in one of the standard orders, there are shortcuts that produce the same effect, for example <option><cmd>1 sorts them by name. Is it possible that this shortcut was typed by mistake without you noticing?"
    I do know about this "clean up by" option, and avoid it like the plague! So I doubt this is the issue, and I infrequently use keyboard shortcuts like this anyway.
    Thanks all who replied. None of the suggestions seem to work, however. Any others out there?
    Regards,
    Sara

  • XI File Adapter Custom File Encoding for  issues between SJIS and CP932

    Dear SAP Forum,
    Has anybody found a solution for the difference between the JVM (IANA) SJIS and MS SJIS implementation ?
    When users enter characters in SAPGUI, the MS SJIS implementation is used, but when the XI file adapter writes SJIS, the JVM SJIS implementation is used, which causes issues for 7 characters:
    1. FULLWIDTH TILDE/EFBD9E                 8160     ~     〜     
    2. PARALLEL TO/E288A5                          8161     ∥     ‖     
    3. FULLWIDTH HYPHEN-MINUS/EFBC8D     817C     -     −     
    4. FULLWIDTH CENT SIGN/EFBFA0             8191     ¢     \u00A2     
    5. FULLWIDTH POUND SIGN/EFBFA1            8192     £     \u00A3     
    6. FULLWIDTH NOT SIGN/EFBFA2              81CA     ¬     \u00AC     
    7. REVERSE SOLIDUS                             815F     \     \u005C
    The following line of code can solve the problem (either in an individual mapping or in a module)
    String sOUT = myString.replace(\u0027~\u0027,\u0027〜\u0027).replace(\u0027∥\u0027,\u0027‖\u0027).replace(\u0027-\u0027,\u0027−\u0027).replace(\u0027¢\u0027,\u0027\u00A2\u0027).replace(\u0027£\u0027,\u0027\u00A3\u0027).replace(\u0027¬\u0027,\u0027\u00AC\u0027);
    But I would prefer to add a custome Character set to the file encoding. Has anybody tried this ?

    Dear SAP Forum,
    Has anybody found a solution for the difference between the JVM (IANA) SJIS and MS SJIS implementation ?
    When users enter characters in SAPGUI, the MS SJIS implementation is used, but when the XI file adapter writes SJIS, the JVM SJIS implementation is used, which causes issues for 7 characters:
    1. FULLWIDTH TILDE/EFBD9E                 8160     ~     〜     
    2. PARALLEL TO/E288A5                          8161     ∥     ‖     
    3. FULLWIDTH HYPHEN-MINUS/EFBC8D     817C     -     −     
    4. FULLWIDTH CENT SIGN/EFBFA0             8191     ¢     \u00A2     
    5. FULLWIDTH POUND SIGN/EFBFA1            8192     £     \u00A3     
    6. FULLWIDTH NOT SIGN/EFBFA2              81CA     ¬     \u00AC     
    7. REVERSE SOLIDUS                             815F     \     \u005C
    The following line of code can solve the problem (either in an individual mapping or in a module)
    String sOUT = myString.replace(\u0027~\u0027,\u0027〜\u0027).replace(\u0027∥\u0027,\u0027‖\u0027).replace(\u0027-\u0027,\u0027−\u0027).replace(\u0027¢\u0027,\u0027\u00A2\u0027).replace(\u0027£\u0027,\u0027\u00A3\u0027).replace(\u0027¬\u0027,\u0027\u00AC\u0027);
    But I would prefer to add a custome Character set to the file encoding. Has anybody tried this ?

  • Field for file selection

    In Acrobat Text Fields have an option Field is used for file selection. With this Text Fields it is possible to select a File in the File Browser and to show the URL of the selected File in the Textfile with a script like var ft = this.getField("URL"); ft.browseForFileToSubmit(). Has someone found a similar possibility in Designer?

    getField does not work on XFA forms. Please have a look at the following document:
    http://www.adobe.com/devnet/livecycle/articles/AcroJS_DesignerJS.pdf

  • Pls Help...for loading a selected word file in SAP B1

    Hi...
    Can I get the Code for loadig a selected Widows Word Document
    (file) in SAP B1

    If you want to open .doc file...
    Private Sub LoadFile(ByVal sFile As String)
      Try
        Dim startInfo As New ProcessStartInfo(sFile)
        startInfo.WindowStyle = ProcessWindowStyle.Maximized
        Process.Start(startInfo)
      Catch ex As Exception
        ' log exception
      Finally
        System.GC.Collect() 'Release the handle to the table
      End Try
    End Sub
    Regards
    Sierdna S.

  • Hello photo work stopped it said could not complete your request because to many files were selected for opening at once

    photo work stopped it said to many files were selected for opening at once

    And you don’t think it might be worth mentioning how many files are actually selected when this happens?
    Please read this (in particular the section titled "Supply pertinent information for quicker answers"):
    http://blogs.adobe.com/crawlspace/2012/07/photoshop-basic-troubleshooting-steps-to-fix-mos t-issues.html
    http://forums.adobe.com/docs/DOC-2325

  • Write to measurement file will not ask for file name once as selected.

    When using the Write to Measurement file Express VI.  I select "Ask user to choose file" and "Ask only once" with the intention that the data from each iteration simply be appended to the chosen file.
    I select "Run continuous" and the VI asks for me to choose a file repeatedly anyway instead of just appending the first file.  Selecting "Write to one file" properly appends data to the file specified in the box.
    Am I doing something wrong?

    DianeS wrote:
    Personally I can't figure out why that particular button even exists (I'm told it's occasionally useful for debugging).  
    I find it useful if I am creating a subVI that is supposed to be a part of another VI.  No while, loop just some inputs and outputs as a function.  If I want to test it out stand alone and try a variety of inputs, then Run Continuous and change the inputs, then I see immediate feedback on the outputs.  Once I'm satisfied its working right, then there is no need to clean up.  Just save it and drop it in the large VI as a subVI.
    Beyond that, I see no need for Run Continuous.

Maybe you are looking for

  • Upgrading from old Mac to new- how to sync iPhone with new Mac?

    Hi all, My dad is upgrading from an old iBook to a nice new iMac. He has spent quite a few days tweaking his new iMac and importing old files and folders. The one thing we haven't yet done, though, is iTunes. He has an iBook G3 that he syncs his iPho

  • Exit code -335 when restarting webas java engine

    Hi , i got an exit code of -335 when restarting the server via MMC. any idea wat caused this. Also could anyone tell me where i can get more details of exit codes. Thanks Rocky

  • Samba version not supported

    I have a Buffalo NAS and used to be able to mount the drive and browse natively within a previous version OS X (not sure after what upgrade it broke) natively without using a 3rd party application. I run 10.8.3 on all of the machines now and when att

  • Un-understandable exception

    Hi, I am getting the following error when requesting a .jsp: type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: com.eclinc

  • Incorrect output scaling on Officejet 7612

    I bought this printer last weekend and it has installed fine.  I have updated the drivers and it will both print and scan.  But I have found that the print output is incorrectly scaled.  I have a PDF document that contains a 12" line that is printed