Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6438246

File name field is mislabeled when JFileChooser is used in DIRECTORIES_ONLY mode

    Details

    • Subcomponent:
    • Resolved In Build:
      b15
    • CPU:
      x86
    • OS:
      windows_xp
    • Verification:
      Verified

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.5.0_06"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
        Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows XP [Version 5.1.2600]

        A DESCRIPTION OF THE PROBLEM :
        When JFileChooser dialog is opened in DIRECTORIES_ONLY mode, the field containing the selected directory path is labeled "File name:". This is very confusing for the users, especially if the dialog is used interchangeably for file and directory selection within the same application.

        The options to alleviate this problem are quite limited. There isn't a more native "directory chooser" in Windows environment (4322989) available. There isn't a customization model allowing for changing of the existing labeling on the dialog (4203820). There is a hack to do that using UIManager, but that is just that.


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        The following snippet reproduces the problem

                     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        JFileChooser fc = new JFileChooser(System.getProperty("user.home"));
        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        fc.showOpenDialog(null);

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The name field should be labeled "Folder name:" or "Directory name:", whichever is right for the current platform.
        ACTUAL -
        The field is always labeled "File name:" regardless of the chooser's selection mode.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        public class DialogTest
        {
           public static void main(String[] args) throws Exception
           {
              IManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              JFileChooser fc = new JFileChooser(System.getProperty("user.home"));
              fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
              fc.showOpenDialog(null);
           }
        }
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        educate the end users
        For Documentum this is very urgent and high priority. I very much hope we can deliver the fix in update 11 as we promised them.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  rupashka Pavel Porvatov (Inactive)
                  Reporter:
                  gmanwanisunw Girish Manwani (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: