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

FileChooser: inconsistent behavior with setInitialName()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • jfx23
    • javafx
    • None

      To reproduce, launch the attached code sample. Select the "txt" option via the combo box and presses the [Save] button, a FileChooser dialog is opened with setInitialFileName() and setInitialDirectory(). Additionally, the extension filters are set with a list in which the first filter corresponds to the selected type.

      Observe the "Save As:" input field in the file chooser.

      With the "txt" extension, "File" portion of the file name is selected, ".txt" portion is unselected (see the screenshot).

      With the "rich" extension, on the other hand, the filename displayed becomes "File.rich.rich" with the "File.rich" portion selected, and the last ".rich" portion unselected (see the screenshot).

      The logic which handles the extension is correct in the "txt" case and is incorrect in the "rich" case.

      In addition to fixing the bug, we should probably clarify setInitialName() javadoc.

            angorya Andy Goryachev
            angorya Andy Goryachev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: